diff options
author | daniel0916 <theschokolps@gmail.com> | 2014-04-18 15:04:32 +0200 |
---|---|---|
committer | daniel0916 <theschokolps@gmail.com> | 2014-04-18 15:04:32 +0200 |
commit | b239de66db5350319ac626700030bfd688851916 (patch) | |
tree | 2dd1b87460eb14678cda808c94002d5cebbc2e4a /src/Generating/NetherFortGen.cpp | |
parent | Fixed Errors (diff) | |
parent | Added performance test of the nether fort generator. (diff) | |
download | cuberite-b239de66db5350319ac626700030bfd688851916.tar cuberite-b239de66db5350319ac626700030bfd688851916.tar.gz cuberite-b239de66db5350319ac626700030bfd688851916.tar.bz2 cuberite-b239de66db5350319ac626700030bfd688851916.tar.lz cuberite-b239de66db5350319ac626700030bfd688851916.tar.xz cuberite-b239de66db5350319ac626700030bfd688851916.tar.zst cuberite-b239de66db5350319ac626700030bfd688851916.zip |
Diffstat (limited to 'src/Generating/NetherFortGen.cpp')
-rw-r--r-- | src/Generating/NetherFortGen.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/Generating/NetherFortGen.cpp b/src/Generating/NetherFortGen.cpp index b6ec46986..d90fdeb0a 100644 --- a/src/Generating/NetherFortGen.cpp +++ b/src/Generating/NetherFortGen.cpp @@ -71,6 +71,40 @@ public: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Performance test of the NetherFort generator: + +/* +#include "OSSupport/Timer.h" +static class cNetherFortPerfTest +{ +public: + cNetherFortPerfTest(void) + { + cTimer Timer; + long long StartTime = Timer.GetNowTime(); + + const int GridSize = 512; + const int MaxDepth = 12; + const int NumIterations = 100; + for (int i = 0; i < NumIterations; i++) + { + cNetherFortGen FortGen(i, GridSize, MaxDepth); + delete new cNetherFortGen::cNetherFort(FortGen, 0, 0, GridSize, MaxDepth, i); + } + + long long EndTime = Timer.GetNowTime(); + printf("%d forts took %lld msec (%f sec) to generate\n", NumIterations, EndTime - StartTime, ((double)(EndTime - StartTime)) / 1000); + exit(0); + } + +} g_PerfTest; +//*/ + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // cNetherFortGen: cNetherFortGen::cNetherFortGen(int a_Seed, int a_GridSize, int a_MaxDepth) : @@ -258,6 +292,15 @@ cPieces cNetherFortGen::GetStartingPieces(void) +int cNetherFortGen::GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const cPiece::cConnector & a_ExistingConnector, const cPiece & a_NewPiece) +{ + return ((const cPrefab &)a_NewPiece).GetPieceWeight(a_PlacedPiece, a_ExistingConnector); +} + + + + + void cNetherFortGen::PiecePlaced(const cPiece & a_Piece) { UNUSED(a_Piece); |