summaryrefslogtreecommitdiffstats
path: root/src/Generating/PieceStructuresGen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Generating/PieceStructuresGen.cpp')
-rw-r--r--src/Generating/PieceStructuresGen.cpp55
1 files changed, 36 insertions, 19 deletions
diff --git a/src/Generating/PieceStructuresGen.cpp b/src/Generating/PieceStructuresGen.cpp
index a0c30a538..1ac655798 100644
--- a/src/Generating/PieceStructuresGen.cpp
+++ b/src/Generating/PieceStructuresGen.cpp
@@ -13,14 +13,12 @@
-class cPieceStructuresGen::cGen:
- public cGridStructGen
+class cPieceStructuresGen::cGen : public cGridStructGen
{
using Super = cGridStructGen;
-public:
-
- cGen(int a_Seed, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen, int a_SeaLevel, const AString & a_Name):
+ public:
+ cGen(int a_Seed, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen, int a_SeaLevel, const AString & a_Name) :
Super(a_Seed),
m_BiomeGen(a_BiomeGen),
m_HeightGen(a_HeightGen),
@@ -43,8 +41,11 @@ public:
}
if (NoCaseCompare(m_PiecePool.GetIntendedUse(), "PieceStructures") != 0)
{
- LOGWARNING("PieceStructures generator: File %s is intended for use in \"%s\", rather than piece structures. Loading the file, but the generator may behave unexpectedly.",
- a_FileName.c_str(), m_PiecePool.GetIntendedUse().c_str()
+ LOGWARNING(
+ "PieceStructures generator: File %s is intended for use in \"%s\", rather than piece structures. "
+ "Loading the file, but the generator may behave unexpectedly.",
+ a_FileName.c_str(),
+ m_PiecePool.GetIntendedUse().c_str()
);
}
m_PiecePool.AssignGens(m_Seed, m_BiomeGen, m_HeightGen, m_SeaLevel);
@@ -65,19 +66,25 @@ public:
cPlacedPieces OutPieces;
cPieceGeneratorBFSTree PieceTree(m_PiecePool, m_Seed);
PieceTree.PlacePieces(a_OriginX, a_OriginZ, m_MaxDepth, OutPieces);
- return std::make_shared<cPrefabStructure>(a_GridX, a_GridZ, a_OriginX, a_OriginZ, std::move(OutPieces), m_HeightGen);
+ return std::make_shared<cPrefabStructure>(
+ a_GridX,
+ a_GridZ,
+ a_OriginX,
+ a_OriginZ,
+ std::move(OutPieces),
+ m_HeightGen
+ );
}
-protected:
-
+ protected:
/** The type used for storing a connection from one piece to another, while building the piece tree. */
struct cConnection
{
- cPiece * m_Piece; // The piece being connected
- cPiece::cConnector m_Connector; // The piece's connector being used (relative non-rotated coords)
- int m_NumCCWRotations; // Number of rotations necessary to match the two connectors
- int m_Weight; // Relative chance that this connection will be chosen
+ cPiece * m_Piece; // The piece being connected
+ cPiece::cConnector m_Connector; // The piece's connector being used (relative non-rotated coords)
+ int m_NumCCWRotations; // Number of rotations necessary to match the two connectors
+ int m_Weight; // Relative chance that this connection will be chosen
cConnection(cPiece & a_Piece, cPiece::cConnector & a_Connector, int a_NumCCWRotations, int a_Weight);
};
@@ -97,7 +104,8 @@ protected:
/** The underlying biome generator that defines whether the structure is created or not */
cBiomeGen & m_BiomeGen;
- /** The underlying height generator, used to position the prefabs crossing chunk borders if they are set to FitGround. */
+ /** The underlying height generator, used to position the prefabs crossing chunk borders if they are set to
+ * FitGround. */
cTerrainHeightGen & m_HeightGen;
/** The world's sea level, if available. Used for some cVerticalStrategy descendants. */
@@ -120,7 +128,7 @@ protected:
////////////////////////////////////////////////////////////////////////////////
// cPieceStructuresGen:
-cPieceStructuresGen::cPieceStructuresGen(int a_Seed):
+cPieceStructuresGen::cPieceStructuresGen(int a_Seed) :
m_Seed(a_Seed)
{
}
@@ -129,13 +137,19 @@ cPieceStructuresGen::cPieceStructuresGen(int a_Seed):
-bool cPieceStructuresGen::Initialize(const AString & a_Prefabs, int a_SeaLevel, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen)
+bool cPieceStructuresGen::Initialize(
+ const AString & a_Prefabs,
+ int a_SeaLevel,
+ cBiomeGen & a_BiomeGen,
+ cTerrainHeightGen & a_HeightGen
+)
{
// Load each piecepool:
auto Structures = StringSplitAndTrim(a_Prefabs, "|");
for (const auto & Structure : Structures)
{
- auto FileName = fmt::format(FMT_STRING("Prefabs{0}PieceStructures{0}{1}.cubeset"), cFile::PathSeparator(), Structure);
+ auto FileName =
+ fmt::format(FMT_STRING("Prefabs{0}PieceStructures{0}{1}.cubeset"), cFile::PathSeparator(), Structure);
if (!cFile::IsFile(FileName))
{
FileName.append(".gz");
@@ -155,7 +169,10 @@ bool cPieceStructuresGen::Initialize(const AString & a_Prefabs, int a_SeaLevel,
// Report a warning if no generators available:
if (m_Gens.empty())
{
- LOGWARNING("The PieceStructures generator was asked to generate \"%s\", but none of the prefabs are valid.", a_Prefabs);
+ LOGWARNING(
+ "The PieceStructures generator was asked to generate \"%s\", but none of the prefabs are valid.",
+ a_Prefabs
+ );
return false;
}
return true;