From 83b25d085c333878e10acb18e6de9e83baf71e65 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 12 Apr 2014 19:36:50 +0200 Subject: Updated the NetherFort prefabs to current Gallery contents. Code exported from the Gallery server by the GalExport plugin. --- src/Generating/NetherFortGen.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/Generating/NetherFortGen.cpp') diff --git a/src/Generating/NetherFortGen.cpp b/src/Generating/NetherFortGen.cpp index 02779a8a3..b6ec46986 100644 --- a/src/Generating/NetherFortGen.cpp +++ b/src/Generating/NetherFortGen.cpp @@ -80,9 +80,9 @@ cNetherFortGen::cNetherFortGen(int a_Seed, int a_GridSize, int a_MaxDepth) : m_MaxDepth(a_MaxDepth) { // Initialize the prefabs: - for (size_t i = 0; i < g_NetherFortPrefabs1Count; i++) + for (size_t i = 0; i < g_NetherFortPrefabsCount; i++) { - cPrefab * Prefab = new cPrefab(g_NetherFortPrefabs1[i]); + cPrefab * Prefab = new cPrefab(g_NetherFortPrefabs[i]); m_AllPieces.push_back(Prefab); if (Prefab->HasConnectorType(0)) { @@ -95,15 +95,17 @@ cNetherFortGen::cNetherFortGen(int a_Seed, int a_GridSize, int a_MaxDepth) : } // Initialize the starting piece prefabs: - for (size_t i = 0; i < g_NetherFortStartingPrefabs1Count; i++) + for (size_t i = 0; i < g_NetherFortStartingPrefabsCount; i++) { - m_StartingPieces.push_back(new cPrefab(g_NetherFortStartingPrefabs1[i])); + m_StartingPieces.push_back(new cPrefab(g_NetherFortStartingPrefabs[i])); } + /* // DEBUG: Try one round of placement: cPlacedPieces Pieces; cBFSPieceGenerator pg(*this, a_Seed); pg.PlacePieces(0, 64, 0, a_MaxDepth, Pieces); + */ } -- cgit v1.2.3 From be091800f8a39024935b9692a7dae5964979d997 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Apr 2014 17:31:29 +0200 Subject: Prefabs can have per-piece per-placement weights. Fixes #753. Also upgraded NetherFortPrefabs to lates Gallery contents. --- src/Generating/NetherFortGen.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Generating/NetherFortGen.cpp') diff --git a/src/Generating/NetherFortGen.cpp b/src/Generating/NetherFortGen.cpp index b6ec46986..7dc702e3a 100644 --- a/src/Generating/NetherFortGen.cpp +++ b/src/Generating/NetherFortGen.cpp @@ -258,6 +258,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); -- cgit v1.2.3 From 6d3bde52216020c59c7f1851d090bae1d1954f39 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 18 Apr 2014 14:35:33 +0200 Subject: Added performance test of the nether fort generator. --- src/Generating/NetherFortGen.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/Generating/NetherFortGen.cpp') diff --git a/src/Generating/NetherFortGen.cpp b/src/Generating/NetherFortGen.cpp index 7dc702e3a..d90fdeb0a 100644 --- a/src/Generating/NetherFortGen.cpp +++ b/src/Generating/NetherFortGen.cpp @@ -70,6 +70,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: -- cgit v1.2.3