Unified StructureGens and FinisherGens.
Now they are all Finishers. Fixes #398.
This commit is contained in:
parent
29cc1ed051
commit
2f85c9648b
@ -762,7 +762,7 @@ void cStructGenWormNestCaves::ClearCache(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cStructGenWormNestCaves::GenStructures(cChunkDesc & a_ChunkDesc)
|
void cStructGenWormNestCaves::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||||
{
|
{
|
||||||
int ChunkX = a_ChunkDesc.GetChunkX();
|
int ChunkX = a_ChunkDesc.GetChunkX();
|
||||||
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
||||||
@ -902,7 +902,7 @@ static float GetMarbleNoise( float x, float y, float z, cNoise & a_Noise )
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cStructGenMarbleCaves::GenStructures(cChunkDesc & a_ChunkDesc)
|
void cStructGenMarbleCaves::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||||
{
|
{
|
||||||
cNoise Noise(m_Seed);
|
cNoise Noise(m_Seed);
|
||||||
for (int z = 0; z < cChunkDef::Width; z++)
|
for (int z = 0; z < cChunkDef::Width; z++)
|
||||||
@ -938,7 +938,7 @@ void cStructGenMarbleCaves::GenStructures(cChunkDesc & a_ChunkDesc)
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// cStructGenDualRidgeCaves:
|
// cStructGenDualRidgeCaves:
|
||||||
|
|
||||||
void cStructGenDualRidgeCaves::GenStructures(cChunkDesc & a_ChunkDesc)
|
void cStructGenDualRidgeCaves::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||||
{
|
{
|
||||||
for (int z = 0; z < cChunkDef::Width; z++)
|
for (int z = 0; z < cChunkDef::Width; z++)
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class cStructGenMarbleCaves :
|
class cStructGenMarbleCaves :
|
||||||
public cStructureGen
|
public cFinishGen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cStructGenMarbleCaves(int a_Seed) : m_Seed(a_Seed) {}
|
cStructGenMarbleCaves(int a_Seed) : m_Seed(a_Seed) {}
|
||||||
@ -29,8 +29,8 @@ protected:
|
|||||||
|
|
||||||
int m_Seed;
|
int m_Seed;
|
||||||
|
|
||||||
// cStructureGen override:
|
// cFinishGen override:
|
||||||
virtual void GenStructures(cChunkDesc & a_ChunkDesc) override;
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
class cStructGenDualRidgeCaves :
|
class cStructGenDualRidgeCaves :
|
||||||
public cStructureGen
|
public cFinishGen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cStructGenDualRidgeCaves(int a_Seed, float a_Threshold) :
|
cStructGenDualRidgeCaves(int a_Seed, float a_Threshold) :
|
||||||
@ -55,8 +55,8 @@ protected:
|
|||||||
int m_Seed;
|
int m_Seed;
|
||||||
float m_Threshold;
|
float m_Threshold;
|
||||||
|
|
||||||
// cStructureGen override:
|
// cFinishGen override:
|
||||||
virtual void GenStructures(cChunkDesc & a_ChunkDesc) override;
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
class cStructGenWormNestCaves :
|
class cStructGenWormNestCaves :
|
||||||
public cStructureGen
|
public cFinishGen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cStructGenWormNestCaves(int a_Seed, int a_Size = 64, int a_Grid = 96, int a_MaxOffset = 128) :
|
cStructGenWormNestCaves(int a_Seed, int a_Size = 64, int a_Grid = 96, int a_MaxOffset = 128) :
|
||||||
@ -94,7 +94,7 @@ protected:
|
|||||||
void GetCavesForChunk(int a_ChunkX, int a_ChunkZ, cCaveSystems & a_Caves);
|
void GetCavesForChunk(int a_ChunkX, int a_ChunkZ, cCaveSystems & a_Caves);
|
||||||
|
|
||||||
// cStructGen override:
|
// cStructGen override:
|
||||||
virtual void GenStructures(cChunkDesc & a_ChunkDesc) override;
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,11 +133,6 @@ cComposableGenerator::~cComposableGenerator()
|
|||||||
delete *itr;
|
delete *itr;
|
||||||
}
|
}
|
||||||
m_FinishGens.clear();
|
m_FinishGens.clear();
|
||||||
for (cStructureGenList::const_iterator itr = m_StructureGens.begin(); itr != m_StructureGens.end(); ++itr)
|
|
||||||
{
|
|
||||||
delete *itr;
|
|
||||||
}
|
|
||||||
m_StructureGens.clear();
|
|
||||||
|
|
||||||
delete m_CompositionGen;
|
delete m_CompositionGen;
|
||||||
m_CompositionGen = NULL;
|
m_CompositionGen = NULL;
|
||||||
@ -164,7 +159,6 @@ void cComposableGenerator::Initialize(cIniFile & a_IniFile)
|
|||||||
InitBiomeGen(a_IniFile);
|
InitBiomeGen(a_IniFile);
|
||||||
InitHeightGen(a_IniFile);
|
InitHeightGen(a_IniFile);
|
||||||
InitCompositionGen(a_IniFile);
|
InitCompositionGen(a_IniFile);
|
||||||
InitStructureGens(a_IniFile);
|
|
||||||
InitFinishGens(a_IniFile);
|
InitFinishGens(a_IniFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,14 +195,6 @@ void cComposableGenerator::DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a
|
|||||||
m_CompositionGen->ComposeTerrain(a_ChunkDesc);
|
m_CompositionGen->ComposeTerrain(a_ChunkDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a_ChunkDesc.IsUsingDefaultStructures())
|
|
||||||
{
|
|
||||||
for (cStructureGenList::iterator itr = m_StructureGens.begin(); itr != m_StructureGens.end(); ++itr)
|
|
||||||
{
|
|
||||||
(*itr)->GenStructures(a_ChunkDesc);
|
|
||||||
} // for itr - m_StructureGens[]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a_ChunkDesc.IsUsingDefaultFinish())
|
if (a_ChunkDesc.IsUsingDefaultFinish())
|
||||||
{
|
{
|
||||||
for (cFinishGenList::iterator itr = m_FinishGens.begin(); itr != m_FinishGens.end(); ++itr)
|
for (cFinishGenList::iterator itr = m_FinishGens.begin(); itr != m_FinishGens.end(); ++itr)
|
||||||
@ -290,86 +276,26 @@ void cComposableGenerator::InitCompositionGen(cIniFile & a_IniFile)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cComposableGenerator::InitStructureGens(cIniFile & a_IniFile)
|
|
||||||
{
|
|
||||||
AString Structures = a_IniFile.GetValueSet("Generator", "Structures", "Ravines, WormNestCaves, WaterLakes, LavaLakes, OreNests, Trees");
|
|
||||||
|
|
||||||
int Seed = m_ChunkGenerator.GetSeed();
|
|
||||||
AStringVector Str = StringSplitAndTrim(Structures, ",");
|
|
||||||
for (AStringVector::const_iterator itr = Str.begin(); itr != Str.end(); ++itr)
|
|
||||||
{
|
|
||||||
if (NoCaseCompare(*itr, "DualRidgeCaves") == 0)
|
|
||||||
{
|
|
||||||
float Threshold = (float)a_IniFile.GetValueSetF("Generator", "DualRidgeCavesThreshold", 0.3);
|
|
||||||
m_StructureGens.push_back(new cStructGenDualRidgeCaves(Seed, Threshold));
|
|
||||||
}
|
|
||||||
else if (NoCaseCompare(*itr, "DirectOverhangs") == 0)
|
|
||||||
{
|
|
||||||
m_StructureGens.push_back(new cStructGenDirectOverhangs(Seed));
|
|
||||||
}
|
|
||||||
else if (NoCaseCompare(*itr, "DistortedMembraneOverhangs") == 0)
|
|
||||||
{
|
|
||||||
m_StructureGens.push_back(new cStructGenDistortedMembraneOverhangs(Seed));
|
|
||||||
}
|
|
||||||
else if (NoCaseCompare(*itr, "LavaLakes") == 0)
|
|
||||||
{
|
|
||||||
int Probability = a_IniFile.GetValueSetI("Generator", "LavaLakesProbability", 10);
|
|
||||||
m_StructureGens.push_back(new cStructGenLakes(Seed * 5 + 16873, E_BLOCK_STATIONARY_LAVA, *m_HeightGen, Probability));
|
|
||||||
}
|
|
||||||
else if (NoCaseCompare(*itr, "MarbleCaves") == 0)
|
|
||||||
{
|
|
||||||
m_StructureGens.push_back(new cStructGenMarbleCaves(Seed));
|
|
||||||
}
|
|
||||||
else if (NoCaseCompare(*itr, "MineShafts") == 0)
|
|
||||||
{
|
|
||||||
int GridSize = a_IniFile.GetValueSetI("Generator", "MineShaftsGridSize", 512);
|
|
||||||
int MaxSystemSize = a_IniFile.GetValueSetI("Generator", "MineShaftsMaxSystemSize", 160);
|
|
||||||
int ChanceCorridor = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceCorridor", 600);
|
|
||||||
int ChanceCrossing = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceCrossing", 200);
|
|
||||||
int ChanceStaircase = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceStaircase", 200);
|
|
||||||
m_StructureGens.push_back(new cStructGenMineShafts(
|
|
||||||
Seed, GridSize, MaxSystemSize,
|
|
||||||
ChanceCorridor, ChanceCrossing, ChanceStaircase
|
|
||||||
));
|
|
||||||
}
|
|
||||||
else if (NoCaseCompare(*itr, "OreNests") == 0)
|
|
||||||
{
|
|
||||||
m_StructureGens.push_back(new cStructGenOreNests(Seed));
|
|
||||||
}
|
|
||||||
else if (NoCaseCompare(*itr, "Ravines") == 0)
|
|
||||||
{
|
|
||||||
m_StructureGens.push_back(new cStructGenRavines(Seed, 128));
|
|
||||||
}
|
|
||||||
else if (NoCaseCompare(*itr, "Trees") == 0)
|
|
||||||
{
|
|
||||||
m_StructureGens.push_back(new cStructGenTrees(Seed, m_BiomeGen, m_HeightGen, m_CompositionGen));
|
|
||||||
}
|
|
||||||
else if (NoCaseCompare(*itr, "WaterLakes") == 0)
|
|
||||||
{
|
|
||||||
int Probability = a_IniFile.GetValueSetI("Generator", "WaterLakesProbability", 25);
|
|
||||||
m_StructureGens.push_back(new cStructGenLakes(Seed * 3 + 652, E_BLOCK_STATIONARY_WATER, *m_HeightGen, Probability));
|
|
||||||
}
|
|
||||||
else if (NoCaseCompare(*itr, "WormNestCaves") == 0)
|
|
||||||
{
|
|
||||||
m_StructureGens.push_back(new cStructGenWormNestCaves(Seed));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOGWARNING("Unknown structure generator: \"%s\". Ignoring.", itr->c_str());
|
|
||||||
}
|
|
||||||
} // for itr - Str[]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
|
void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
|
||||||
{
|
{
|
||||||
int Seed = m_ChunkGenerator.GetSeed();
|
int Seed = m_ChunkGenerator.GetSeed();
|
||||||
eDimension Dimension = StringToDimension(a_IniFile.GetValue("General", "Dimension", "Overworld"));
|
eDimension Dimension = StringToDimension(a_IniFile.GetValue("General", "Dimension", "Overworld"));
|
||||||
|
|
||||||
AString Finishers = a_IniFile.GetValueSet("Generator", "Finishers", "SprinkleFoliage,Ice,Snow,Lilypads,BottomLava,DeadBushes,PreSimulator");
|
// Older configuration used "Structures" in addition to "Finishers"; we don't distinguish between the two anymore (#398)
|
||||||
|
// Therefore, we load Structures from the ini file for compatibility, but move its contents over to Finishers:
|
||||||
|
AString Structures = a_IniFile.GetValue("Generator", "Structures", "");
|
||||||
|
AString Finishers = a_IniFile.GetValueSet("Generator", "Finishers", "Ravines, WormNestCaves, WaterLakes, LavaLakes, OreNests, Trees, SprinkleFoliage, Ice, Snow, Lilypads, BottomLava, DeadBushes, PreSimulator");
|
||||||
|
if (!Structures.empty())
|
||||||
|
{
|
||||||
|
LOGINFO("[Generator].Structures is deprecated, moving the contents to [Generator].Finishers.");
|
||||||
|
// Structures used to generate before Finishers, so place them first:
|
||||||
|
Structures.append(", ");
|
||||||
|
Finishers = Structures + Finishers;
|
||||||
|
a_IniFile.SetValue("Generator", "Finishers", Finishers);
|
||||||
|
}
|
||||||
|
a_IniFile.DeleteValue("Generator", "Structures");
|
||||||
|
|
||||||
|
// Create all requested finishers:
|
||||||
AStringVector Str = StringSplitAndTrim(Finishers, ",");
|
AStringVector Str = StringSplitAndTrim(Finishers, ",");
|
||||||
for (AStringVector::const_iterator itr = Str.begin(); itr != Str.end(); ++itr)
|
for (AStringVector::const_iterator itr = Str.begin(); itr != Str.end(); ++itr)
|
||||||
{
|
{
|
||||||
@ -384,14 +310,48 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
|
|||||||
{
|
{
|
||||||
m_FinishGens.push_back(new cFinishGenSingleBiomeSingleTopBlock(Seed, E_BLOCK_DEAD_BUSH, biDesert, 2, E_BLOCK_SAND, E_BLOCK_SAND));
|
m_FinishGens.push_back(new cFinishGenSingleBiomeSingleTopBlock(Seed, E_BLOCK_DEAD_BUSH, biDesert, 2, E_BLOCK_SAND, E_BLOCK_SAND));
|
||||||
}
|
}
|
||||||
|
else if (NoCaseCompare(*itr, "DirectOverhangs") == 0)
|
||||||
|
{
|
||||||
|
m_FinishGens.push_back(new cStructGenDirectOverhangs(Seed));
|
||||||
|
}
|
||||||
|
else if (NoCaseCompare(*itr, "DistortedMembraneOverhangs") == 0)
|
||||||
|
{
|
||||||
|
m_FinishGens.push_back(new cStructGenDistortedMembraneOverhangs(Seed));
|
||||||
|
}
|
||||||
|
else if (NoCaseCompare(*itr, "DualRidgeCaves") == 0)
|
||||||
|
{
|
||||||
|
float Threshold = (float)a_IniFile.GetValueSetF("Generator", "DualRidgeCavesThreshold", 0.3);
|
||||||
|
m_FinishGens.push_back(new cStructGenDualRidgeCaves(Seed, Threshold));
|
||||||
|
}
|
||||||
else if (NoCaseCompare(*itr, "Ice") == 0)
|
else if (NoCaseCompare(*itr, "Ice") == 0)
|
||||||
{
|
{
|
||||||
m_FinishGens.push_back(new cFinishGenIce);
|
m_FinishGens.push_back(new cFinishGenIce);
|
||||||
}
|
}
|
||||||
|
else if (NoCaseCompare(*itr, "LavaLakes") == 0)
|
||||||
|
{
|
||||||
|
int Probability = a_IniFile.GetValueSetI("Generator", "LavaLakesProbability", 10);
|
||||||
|
m_FinishGens.push_back(new cStructGenLakes(Seed * 5 + 16873, E_BLOCK_STATIONARY_LAVA, *m_HeightGen, Probability));
|
||||||
|
}
|
||||||
else if (NoCaseCompare(*itr, "LavaSprings") == 0)
|
else if (NoCaseCompare(*itr, "LavaSprings") == 0)
|
||||||
{
|
{
|
||||||
m_FinishGens.push_back(new cFinishGenFluidSprings(Seed, E_BLOCK_LAVA, a_IniFile, Dimension));
|
m_FinishGens.push_back(new cFinishGenFluidSprings(Seed, E_BLOCK_LAVA, a_IniFile, Dimension));
|
||||||
}
|
}
|
||||||
|
else if (NoCaseCompare(*itr, "MarbleCaves") == 0)
|
||||||
|
{
|
||||||
|
m_FinishGens.push_back(new cStructGenMarbleCaves(Seed));
|
||||||
|
}
|
||||||
|
else if (NoCaseCompare(*itr, "MineShafts") == 0)
|
||||||
|
{
|
||||||
|
int GridSize = a_IniFile.GetValueSetI("Generator", "MineShaftsGridSize", 512);
|
||||||
|
int MaxSystemSize = a_IniFile.GetValueSetI("Generator", "MineShaftsMaxSystemSize", 160);
|
||||||
|
int ChanceCorridor = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceCorridor", 600);
|
||||||
|
int ChanceCrossing = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceCrossing", 200);
|
||||||
|
int ChanceStaircase = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceStaircase", 200);
|
||||||
|
m_FinishGens.push_back(new cStructGenMineShafts(
|
||||||
|
Seed, GridSize, MaxSystemSize,
|
||||||
|
ChanceCorridor, ChanceCrossing, ChanceStaircase
|
||||||
|
));
|
||||||
|
}
|
||||||
else if (NoCaseCompare(*itr, "Lilypads") == 0)
|
else if (NoCaseCompare(*itr, "Lilypads") == 0)
|
||||||
{
|
{
|
||||||
m_FinishGens.push_back(new cFinishGenSingleBiomeSingleTopBlock(Seed, E_BLOCK_LILY_PAD, biSwampland, 4, E_BLOCK_WATER, E_BLOCK_STATIONARY_WATER));
|
m_FinishGens.push_back(new cFinishGenSingleBiomeSingleTopBlock(Seed, E_BLOCK_LILY_PAD, biSwampland, 4, E_BLOCK_WATER, E_BLOCK_STATIONARY_WATER));
|
||||||
@ -400,10 +360,18 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
|
|||||||
{
|
{
|
||||||
m_FinishGens.push_back(new cFinishGenNetherClumpFoliage(Seed));
|
m_FinishGens.push_back(new cFinishGenNetherClumpFoliage(Seed));
|
||||||
}
|
}
|
||||||
|
else if (NoCaseCompare(*itr, "OreNests") == 0)
|
||||||
|
{
|
||||||
|
m_FinishGens.push_back(new cStructGenOreNests(Seed));
|
||||||
|
}
|
||||||
else if (NoCaseCompare(*itr, "PreSimulator") == 0)
|
else if (NoCaseCompare(*itr, "PreSimulator") == 0)
|
||||||
{
|
{
|
||||||
m_FinishGens.push_back(new cFinishGenPreSimulator);
|
m_FinishGens.push_back(new cFinishGenPreSimulator);
|
||||||
}
|
}
|
||||||
|
else if (NoCaseCompare(*itr, "Ravines") == 0)
|
||||||
|
{
|
||||||
|
m_FinishGens.push_back(new cStructGenRavines(Seed, 128));
|
||||||
|
}
|
||||||
else if (NoCaseCompare(*itr, "Snow") == 0)
|
else if (NoCaseCompare(*itr, "Snow") == 0)
|
||||||
{
|
{
|
||||||
m_FinishGens.push_back(new cFinishGenSnow);
|
m_FinishGens.push_back(new cFinishGenSnow);
|
||||||
@ -412,10 +380,27 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
|
|||||||
{
|
{
|
||||||
m_FinishGens.push_back(new cFinishGenSprinkleFoliage(Seed));
|
m_FinishGens.push_back(new cFinishGenSprinkleFoliage(Seed));
|
||||||
}
|
}
|
||||||
|
else if (NoCaseCompare(*itr, "Trees") == 0)
|
||||||
|
{
|
||||||
|
m_FinishGens.push_back(new cStructGenTrees(Seed, m_BiomeGen, m_HeightGen, m_CompositionGen));
|
||||||
|
}
|
||||||
|
else if (NoCaseCompare(*itr, "WaterLakes") == 0)
|
||||||
|
{
|
||||||
|
int Probability = a_IniFile.GetValueSetI("Generator", "WaterLakesProbability", 25);
|
||||||
|
m_FinishGens.push_back(new cStructGenLakes(Seed * 3 + 652, E_BLOCK_STATIONARY_WATER, *m_HeightGen, Probability));
|
||||||
|
}
|
||||||
else if (NoCaseCompare(*itr, "WaterSprings") == 0)
|
else if (NoCaseCompare(*itr, "WaterSprings") == 0)
|
||||||
{
|
{
|
||||||
m_FinishGens.push_back(new cFinishGenFluidSprings(Seed, E_BLOCK_WATER, a_IniFile, Dimension));
|
m_FinishGens.push_back(new cFinishGenFluidSprings(Seed, E_BLOCK_WATER, a_IniFile, Dimension));
|
||||||
}
|
}
|
||||||
|
else if (NoCaseCompare(*itr, "WormNestCaves") == 0)
|
||||||
|
{
|
||||||
|
m_FinishGens.push_back(new cStructGenWormNestCaves(Seed));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGWARNING("Unknown Finisher in the [Generator] section: \"%s\". Ignoring.", itr->c_str());
|
||||||
|
}
|
||||||
} // for itr - Str[]
|
} // for itr - Str[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,16 +43,16 @@ class cBiomeGen
|
|||||||
public:
|
public:
|
||||||
virtual ~cBiomeGen() {} // Force a virtual destructor in descendants
|
virtual ~cBiomeGen() {} // Force a virtual destructor in descendants
|
||||||
|
|
||||||
/// Generates biomes for the given chunk
|
/** Generates biomes for the given chunk */
|
||||||
virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) = 0;
|
virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) = 0;
|
||||||
|
|
||||||
/// Reads parameters from the ini file, prepares generator for use.
|
/** Reads parameters from the ini file, prepares generator for use. */
|
||||||
virtual void InitializeBiomeGen(cIniFile & a_IniFile) {}
|
virtual void InitializeBiomeGen(cIniFile & a_IniFile) {}
|
||||||
|
|
||||||
/// Creates the correct BiomeGen descendant based on the ini file settings and the seed provided.
|
/** Creates the correct BiomeGen descendant based on the ini file settings and the seed provided.
|
||||||
/// a_CacheOffByDefault gets set to whether the cache should be disabled by default
|
a_CacheOffByDefault gets set to whether the cache should be disabled by default.
|
||||||
/// Used in BiomeVisualiser, too.
|
Used in BiomeVisualiser, too.
|
||||||
/// Implemented in BioGen.cpp!
|
Implemented in BioGen.cpp! */
|
||||||
static cBiomeGen * CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool & a_CacheOffByDefault);
|
static cBiomeGen * CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool & a_CacheOffByDefault);
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
@ -72,10 +72,10 @@ class cTerrainHeightGen
|
|||||||
public:
|
public:
|
||||||
virtual ~cTerrainHeightGen() {} // Force a virtual destructor in descendants
|
virtual ~cTerrainHeightGen() {} // Force a virtual destructor in descendants
|
||||||
|
|
||||||
/// Generates heightmap for the given chunk
|
/** Generates heightmap for the given chunk */
|
||||||
virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) = 0;
|
virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) = 0;
|
||||||
|
|
||||||
/// Reads parameters from the ini file, prepares generator for use.
|
/** Reads parameters from the ini file, prepares generator for use. */
|
||||||
virtual void InitializeHeightGen(cIniFile & a_IniFile) {}
|
virtual void InitializeHeightGen(cIniFile & a_IniFile) {}
|
||||||
|
|
||||||
/** Creates the correct TerrainHeightGen descendant based on the ini file settings and the seed provided.
|
/** Creates the correct TerrainHeightGen descendant based on the ini file settings and the seed provided.
|
||||||
@ -102,7 +102,7 @@ public:
|
|||||||
|
|
||||||
virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) = 0;
|
virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc) = 0;
|
||||||
|
|
||||||
/// Reads parameters from the ini file, prepares generator for use.
|
/** Reads parameters from the ini file, prepares generator for use. */
|
||||||
virtual void InitializeCompoGen(cIniFile & a_IniFile) {}
|
virtual void InitializeCompoGen(cIniFile & a_IniFile) {}
|
||||||
|
|
||||||
/** Creates the correct TerrainCompositionGen descendant based on the ini file settings and the seed provided.
|
/** Creates the correct TerrainCompositionGen descendant based on the ini file settings and the seed provided.
|
||||||
@ -116,28 +116,12 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** The interface that a structure generator must implement
|
|
||||||
Structures are generated after the terrain composition took place. It should modify the blocktype data to account
|
|
||||||
for whatever structures the generator is generating.
|
|
||||||
Note that ores are considered structures too, at least from the interface point of view.
|
|
||||||
Also note that a worldgenerator may contain multiple structure generators, one for each type of structure
|
|
||||||
*/
|
|
||||||
class cStructureGen
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual ~cStructureGen() {} // Force a virtual destructor in descendants
|
|
||||||
|
|
||||||
virtual void GenStructures(cChunkDesc & a_ChunkDesc) = 0;
|
|
||||||
} ;
|
|
||||||
|
|
||||||
typedef std::list<cStructureGen *> cStructureGenList;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** The interface that a finisher must implement
|
/** The interface that a finisher must implement
|
||||||
Finisher implements small additions after all structures have been generated.
|
Finisher implements changes to the chunk after the rough terrain has been generated.
|
||||||
|
Examples of finishers are trees, snow, ore, lilypads and others.
|
||||||
|
Note that a worldgenerator may contain multiple finishers.
|
||||||
|
Also note that previously we used to distinguish between a structuregen and a finisher; this distinction is
|
||||||
|
no longer relevant, all structure generators are considered finishers now (#398)
|
||||||
*/
|
*/
|
||||||
class cFinishGen
|
class cFinishGen
|
||||||
{
|
{
|
||||||
@ -171,7 +155,6 @@ protected:
|
|||||||
cBiomeGen * m_BiomeGen;
|
cBiomeGen * m_BiomeGen;
|
||||||
cTerrainHeightGen * m_HeightGen;
|
cTerrainHeightGen * m_HeightGen;
|
||||||
cTerrainCompositionGen * m_CompositionGen;
|
cTerrainCompositionGen * m_CompositionGen;
|
||||||
cStructureGenList m_StructureGens;
|
|
||||||
cFinishGenList m_FinishGens;
|
cFinishGenList m_FinishGens;
|
||||||
|
|
||||||
// Generators underlying the caches:
|
// Generators underlying the caches:
|
||||||
@ -180,19 +163,16 @@ protected:
|
|||||||
cTerrainCompositionGen * m_UnderlyingCompositionGen;
|
cTerrainCompositionGen * m_UnderlyingCompositionGen;
|
||||||
|
|
||||||
|
|
||||||
/// Reads the biome gen settings from the ini and initializes m_BiomeGen accordingly
|
/** Reads the biome gen settings from the ini and initializes m_BiomeGen accordingly */
|
||||||
void InitBiomeGen(cIniFile & a_IniFile);
|
void InitBiomeGen(cIniFile & a_IniFile);
|
||||||
|
|
||||||
/// Reads the HeightGen settings from the ini and initializes m_HeightGen accordingly
|
/** Reads the HeightGen settings from the ini and initializes m_HeightGen accordingly */
|
||||||
void InitHeightGen(cIniFile & a_IniFile);
|
void InitHeightGen(cIniFile & a_IniFile);
|
||||||
|
|
||||||
/// Reads the CompositionGen settings from the ini and initializes m_CompositionGen accordingly
|
/** Reads the CompositionGen settings from the ini and initializes m_CompositionGen accordingly */
|
||||||
void InitCompositionGen(cIniFile & a_IniFile);
|
void InitCompositionGen(cIniFile & a_IniFile);
|
||||||
|
|
||||||
/// Reads the structures to generate from the ini and initializes m_StructureGens accordingly
|
/** Reads the finishers from the ini and initializes m_FinishGens accordingly */
|
||||||
void InitStructureGens(cIniFile & a_IniFile);
|
|
||||||
|
|
||||||
/// Reads the finishers from the ini and initializes m_FinishGens accordingly
|
|
||||||
void InitFinishGens(cIniFile & a_IniFile);
|
void InitFinishGens(cIniFile & a_IniFile);
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
@ -1407,7 +1407,7 @@ void cStructGenMineShafts::GetMineShaftSystemsForChunk(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cStructGenMineShafts::GenStructures(cChunkDesc & a_ChunkDesc)
|
void cStructGenMineShafts::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||||
{
|
{
|
||||||
int ChunkX = a_ChunkDesc.GetChunkX();
|
int ChunkX = a_ChunkDesc.GetChunkX();
|
||||||
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class cStructGenMineShafts :
|
class cStructGenMineShafts :
|
||||||
public cStructureGen
|
public cFinishGen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cStructGenMineShafts(
|
cStructGenMineShafts(
|
||||||
@ -52,8 +52,8 @@ protected:
|
|||||||
*/
|
*/
|
||||||
void GetMineShaftSystemsForChunk(int a_ChunkX, int a_ChunkZ, cMineShaftSystems & a_MineShaftSystems);
|
void GetMineShaftSystemsForChunk(int a_ChunkX, int a_ChunkZ, cMineShaftSystems & a_MineShaftSystems);
|
||||||
|
|
||||||
// cStructureGen overrides:
|
// cFinishGen overrides:
|
||||||
virtual void GenStructures(cChunkDesc & a_ChunkDesc) override;
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ void cStructGenRavines::ClearCache(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cStructGenRavines::GenStructures(cChunkDesc & a_ChunkDesc)
|
void cStructGenRavines::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||||
{
|
{
|
||||||
int ChunkX = a_ChunkDesc.GetChunkX();
|
int ChunkX = a_ChunkDesc.GetChunkX();
|
||||||
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class cStructGenRavines :
|
class cStructGenRavines :
|
||||||
public cStructureGen
|
public cFinishGen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cStructGenRavines(int a_Seed, int a_Size);
|
cStructGenRavines(int a_Seed, int a_Size);
|
||||||
@ -37,8 +37,8 @@ protected:
|
|||||||
/// Returns all ravines that *may* intersect the given chunk. All the ravines are valid until the next call to this function.
|
/// Returns all ravines that *may* intersect the given chunk. All the ravines are valid until the next call to this function.
|
||||||
void GetRavinesForChunk(int a_ChunkX, int a_ChunkZ, cRavines & a_Ravines);
|
void GetRavinesForChunk(int a_ChunkX, int a_ChunkZ, cRavines & a_Ravines);
|
||||||
|
|
||||||
// cStructureGen override:
|
// cFinishGen override:
|
||||||
virtual void GenStructures(cChunkDesc & a_ChunkDesc) override;
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ const int NEST_SIZE_GRAVEL = 32;
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// cStructGenTrees:
|
// cStructGenTrees:
|
||||||
|
|
||||||
void cStructGenTrees::GenStructures(cChunkDesc & a_ChunkDesc)
|
void cStructGenTrees::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||||
{
|
{
|
||||||
int ChunkX = a_ChunkDesc.GetChunkX();
|
int ChunkX = a_ChunkDesc.GetChunkX();
|
||||||
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
||||||
@ -306,7 +306,7 @@ int cStructGenTrees::GetNumTrees(
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// cStructGenOreNests:
|
// cStructGenOreNests:
|
||||||
|
|
||||||
void cStructGenOreNests::GenStructures(cChunkDesc & a_ChunkDesc)
|
void cStructGenOreNests::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||||
{
|
{
|
||||||
int ChunkX = a_ChunkDesc.GetChunkX();
|
int ChunkX = a_ChunkDesc.GetChunkX();
|
||||||
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
||||||
@ -413,7 +413,7 @@ void cStructGenOreNests::GenerateOre(int a_ChunkX, int a_ChunkZ, BLOCKTYPE a_Ore
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// cStructGenLakes:
|
// cStructGenLakes:
|
||||||
|
|
||||||
void cStructGenLakes::GenStructures(cChunkDesc & a_ChunkDesc)
|
void cStructGenLakes::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||||
{
|
{
|
||||||
int ChunkX = a_ChunkDesc.GetChunkX();
|
int ChunkX = a_ChunkDesc.GetChunkX();
|
||||||
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
int ChunkZ = a_ChunkDesc.GetChunkZ();
|
||||||
@ -545,7 +545,7 @@ cStructGenDirectOverhangs::cStructGenDirectOverhangs(int a_Seed) :
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cStructGenDirectOverhangs::GenStructures(cChunkDesc & a_ChunkDesc)
|
void cStructGenDirectOverhangs::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||||
{
|
{
|
||||||
// If there is no column of the wanted biome, bail out:
|
// If there is no column of the wanted biome, bail out:
|
||||||
if (!HasWantedBiome(a_ChunkDesc))
|
if (!HasWantedBiome(a_ChunkDesc))
|
||||||
@ -665,7 +665,7 @@ cStructGenDistortedMembraneOverhangs::cStructGenDistortedMembraneOverhangs(int a
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cStructGenDistortedMembraneOverhangs::GenStructures(cChunkDesc & a_ChunkDesc)
|
void cStructGenDistortedMembraneOverhangs::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||||
{
|
{
|
||||||
const NOISE_DATATYPE Frequency = (NOISE_DATATYPE)16;
|
const NOISE_DATATYPE Frequency = (NOISE_DATATYPE)16;
|
||||||
const NOISE_DATATYPE Amount = (NOISE_DATATYPE)1;
|
const NOISE_DATATYPE Amount = (NOISE_DATATYPE)1;
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class cStructGenTrees :
|
class cStructGenTrees :
|
||||||
public cStructureGen
|
public cFinishGen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cStructGenTrees(int a_Seed, cBiomeGen * a_BiomeGen, cTerrainHeightGen * a_HeightGen, cTerrainCompositionGen * a_CompositionGen) :
|
cStructGenTrees(int a_Seed, cBiomeGen * a_BiomeGen, cTerrainHeightGen * a_HeightGen, cTerrainCompositionGen * a_CompositionGen) :
|
||||||
@ -64,8 +64,8 @@ protected:
|
|||||||
const cChunkDef::BiomeMap & a_Biomes
|
const cChunkDef::BiomeMap & a_Biomes
|
||||||
);
|
);
|
||||||
|
|
||||||
// cStructureGen override:
|
// cFinishGen override:
|
||||||
virtual void GenStructures(cChunkDesc & a_ChunkDesc) override;
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
class cStructGenOreNests :
|
class cStructGenOreNests :
|
||||||
public cStructureGen
|
public cFinishGen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cStructGenOreNests(int a_Seed) : m_Noise(a_Seed), m_Seed(a_Seed) {}
|
cStructGenOreNests(int a_Seed) : m_Noise(a_Seed), m_Seed(a_Seed) {}
|
||||||
@ -82,8 +82,8 @@ protected:
|
|||||||
cNoise m_Noise;
|
cNoise m_Noise;
|
||||||
int m_Seed;
|
int m_Seed;
|
||||||
|
|
||||||
// cStructureGen override:
|
// cFinishGen override:
|
||||||
virtual void GenStructures(cChunkDesc & a_ChunkDesc) override;
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
||||||
|
|
||||||
void GenerateOre(int a_ChunkX, int a_ChunkZ, BLOCKTYPE a_OreType, int a_MaxHeight, int a_NumNests, int a_NestSize, cChunkDef::BlockTypes & a_BlockTypes, int a_Seq);
|
void GenerateOre(int a_ChunkX, int a_ChunkZ, BLOCKTYPE a_OreType, int a_MaxHeight, int a_NumNests, int a_NestSize, cChunkDef::BlockTypes & a_BlockTypes, int a_Seq);
|
||||||
} ;
|
} ;
|
||||||
@ -93,7 +93,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
class cStructGenLakes :
|
class cStructGenLakes :
|
||||||
public cStructureGen
|
public cFinishGen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cStructGenLakes(int a_Seed, BLOCKTYPE a_Fluid, cTerrainHeightGen & a_HeiGen, int a_Probability) :
|
cStructGenLakes(int a_Seed, BLOCKTYPE a_Fluid, cTerrainHeightGen & a_HeiGen, int a_Probability) :
|
||||||
@ -112,8 +112,8 @@ protected:
|
|||||||
cTerrainHeightGen & m_HeiGen;
|
cTerrainHeightGen & m_HeiGen;
|
||||||
int m_Probability; ///< Chance, 0 .. 100, of a chunk having the lake
|
int m_Probability; ///< Chance, 0 .. 100, of a chunk having the lake
|
||||||
|
|
||||||
// cStructureGen override:
|
// cFinishGen override:
|
||||||
virtual void GenStructures(cChunkDesc & a_ChunkDesc) override;
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
||||||
|
|
||||||
/// Creates a lake image for the specified chunk into a_Lake
|
/// Creates a lake image for the specified chunk into a_Lake
|
||||||
void CreateLakeImage(int a_ChunkX, int a_ChunkZ, cBlockArea & a_Lake);
|
void CreateLakeImage(int a_ChunkX, int a_ChunkZ, cBlockArea & a_Lake);
|
||||||
@ -125,7 +125,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
class cStructGenDirectOverhangs :
|
class cStructGenDirectOverhangs :
|
||||||
public cStructureGen
|
public cFinishGen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cStructGenDirectOverhangs(int a_Seed);
|
cStructGenDirectOverhangs(int a_Seed);
|
||||||
@ -134,8 +134,8 @@ protected:
|
|||||||
cNoise m_Noise1;
|
cNoise m_Noise1;
|
||||||
cNoise m_Noise2;
|
cNoise m_Noise2;
|
||||||
|
|
||||||
// cStructureGen override:
|
// cFinishGen override:
|
||||||
virtual void GenStructures(cChunkDesc & a_ChunkDesc) override;
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
||||||
|
|
||||||
bool HasWantedBiome(cChunkDesc & a_ChunkDesc) const;
|
bool HasWantedBiome(cChunkDesc & a_ChunkDesc) const;
|
||||||
} ;
|
} ;
|
||||||
@ -145,7 +145,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
class cStructGenDistortedMembraneOverhangs :
|
class cStructGenDistortedMembraneOverhangs :
|
||||||
public cStructureGen
|
public cFinishGen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cStructGenDistortedMembraneOverhangs(int a_Seed);
|
cStructGenDistortedMembraneOverhangs(int a_Seed);
|
||||||
@ -156,8 +156,8 @@ protected:
|
|||||||
cNoise m_NoiseZ;
|
cNoise m_NoiseZ;
|
||||||
cNoise m_NoiseH;
|
cNoise m_NoiseH;
|
||||||
|
|
||||||
// cStructureGen override:
|
// cFinishGen override:
|
||||||
virtual void GenStructures(cChunkDesc & a_ChunkDesc) override;
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user