summaryrefslogtreecommitdiffstats
path: root/src/Generating/ComposableGenerator.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2019-09-01 09:30:00 +0200
committerMattes D <github@xoft.cz>2019-09-06 16:12:33 +0200
commita2ffa432b31096f2533ecb50f49ba450b29a2989 (patch)
tree5bdd754cad5e7b49e279ee0e21b9fa15c7c35d7b /src/Generating/ComposableGenerator.cpp
parentUpdated LibEvent to release 2.1.11-stable. (#4383) (diff)
downloadcuberite-a2ffa432b31096f2533ecb50f49ba450b29a2989.tar
cuberite-a2ffa432b31096f2533ecb50f49ba450b29a2989.tar.gz
cuberite-a2ffa432b31096f2533ecb50f49ba450b29a2989.tar.bz2
cuberite-a2ffa432b31096f2533ecb50f49ba450b29a2989.tar.lz
cuberite-a2ffa432b31096f2533ecb50f49ba450b29a2989.tar.xz
cuberite-a2ffa432b31096f2533ecb50f49ba450b29a2989.tar.zst
cuberite-a2ffa432b31096f2533ecb50f49ba450b29a2989.zip
Diffstat (limited to 'src/Generating/ComposableGenerator.cpp')
-rw-r--r--src/Generating/ComposableGenerator.cpp84
1 files changed, 40 insertions, 44 deletions
diff --git a/src/Generating/ComposableGenerator.cpp b/src/Generating/ComposableGenerator.cpp
index c73ecf6cc..1cb3ed7c9 100644
--- a/src/Generating/ComposableGenerator.cpp
+++ b/src/Generating/ComposableGenerator.cpp
@@ -6,9 +6,7 @@
#include "Globals.h"
#include "ComposableGenerator.h"
-#include "../World.h"
#include "../IniFile.h"
-#include "../Root.h"
// Individual composed algorithms:
#include "BioGen.h"
@@ -110,8 +108,7 @@ cTerrainCompositionGenPtr cTerrainCompositionGen::CreateCompositionGen(cIniFile
////////////////////////////////////////////////////////////////////////////////
// cComposableGenerator:
-cComposableGenerator::cComposableGenerator(cChunkGenerator & a_ChunkGenerator) :
- super(a_ChunkGenerator),
+cComposableGenerator::cComposableGenerator():
m_BiomeGen(),
m_ShapeGen(),
m_CompositionGen()
@@ -124,7 +121,7 @@ cComposableGenerator::cComposableGenerator(cChunkGenerator & a_ChunkGenerator) :
void cComposableGenerator::Initialize(cIniFile & a_IniFile)
{
- super::Initialize(a_IniFile);
+ Super::Initialize(a_IniFile);
InitBiomeGen(a_IniFile);
InitShapeGen(a_IniFile);
@@ -148,7 +145,7 @@ void cComposableGenerator::GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef:
-void cComposableGenerator::DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc)
+void cComposableGenerator::Generate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc)
{
if (a_ChunkDesc.IsUsingDefaultBiomes())
{
@@ -195,7 +192,7 @@ void cComposableGenerator::DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a
void cComposableGenerator::InitBiomeGen(cIniFile & a_IniFile)
{
bool CacheOffByDefault = false;
- m_BiomeGen = cBiomeGen::CreateBiomeGen(a_IniFile, m_ChunkGenerator.GetSeed(), CacheOffByDefault);
+ m_BiomeGen = cBiomeGen::CreateBiomeGen(a_IniFile, m_Seed, CacheOffByDefault);
// Add a cache, if requested:
// The default is 16 * 128 caches, which is 2 MiB of RAM. Reasonable, for the amount of work this is saving.
@@ -231,7 +228,7 @@ void cComposableGenerator::InitBiomeGen(cIniFile & a_IniFile)
void cComposableGenerator::InitShapeGen(cIniFile & a_IniFile)
{
bool CacheOffByDefault = false;
- m_ShapeGen = cTerrainShapeGen::CreateShapeGen(a_IniFile, m_BiomeGen, m_ChunkGenerator.GetSeed(), CacheOffByDefault);
+ m_ShapeGen = cTerrainShapeGen::CreateShapeGen(a_IniFile, m_BiomeGen, m_Seed, CacheOffByDefault);
/*
// TODO
@@ -258,7 +255,7 @@ void cComposableGenerator::InitShapeGen(cIniFile & a_IniFile)
void cComposableGenerator::InitCompositionGen(cIniFile & a_IniFile)
{
- m_CompositionGen = cTerrainCompositionGen::CreateCompositionGen(a_IniFile, m_BiomeGen, m_ShapeGen, m_ChunkGenerator.GetSeed());
+ m_CompositionGen = cTerrainCompositionGen::CreateCompositionGen(a_IniFile, m_BiomeGen, m_ShapeGen, m_Seed);
// Add a cache over the composition generator:
// Even a cache of size 1 is useful due to the CompositedHeiGen cache after us doing re-composition on its misses
@@ -279,7 +276,6 @@ void cComposableGenerator::InitCompositionGen(cIniFile & a_IniFile)
void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
{
- int Seed = m_ChunkGenerator.GetSeed();
eDimension Dimension = StringToDimension(a_IniFile.GetValue("General", "Dimension", "Overworld"));
auto seaLevel = a_IniFile.GetValueI("Generator", "SeaLevel");
@@ -298,7 +294,7 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
// Finishers, alpha-sorted:
if (NoCaseCompare(finisher, "Animals") == 0)
{
- m_FinishGens.push_back(cFinishGenPtr(new cFinishGenPassiveMobs(Seed, a_IniFile, Dimension)));
+ m_FinishGens.push_back(cFinishGenPtr(new cFinishGenPassiveMobs(m_Seed, a_IniFile, Dimension)));
}
else if (NoCaseCompare(finisher, "BottomLava") == 0)
{
@@ -327,15 +323,15 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
AllowedBlocks.push_back(E_BLOCK_HARDENED_CLAY);
AllowedBlocks.push_back(E_BLOCK_STAINED_CLAY);
- m_FinishGens.push_back(cFinishGenPtr(new cFinishGenSingleTopBlock(Seed, E_BLOCK_DEAD_BUSH, AllowedBiomes, 2, AllowedBlocks)));
+ m_FinishGens.push_back(cFinishGenPtr(new cFinishGenSingleTopBlock(m_Seed, E_BLOCK_DEAD_BUSH, AllowedBiomes, 2, AllowedBlocks)));
}
else if (NoCaseCompare(finisher, "DirectOverhangs") == 0)
{
- m_FinishGens.push_back(cFinishGenPtr(new cStructGenDirectOverhangs(Seed)));
+ m_FinishGens.push_back(cFinishGenPtr(new cStructGenDirectOverhangs(m_Seed)));
}
else if (NoCaseCompare(finisher, "DirtPockets") == 0)
{
- auto gen = std::make_shared<cFinishGenOrePockets>(Seed + 1, cFinishGenOrePockets::DefaultNaturalPatches());
+ auto gen = std::make_shared<cFinishGenOrePockets>(m_Seed + 1, cFinishGenOrePockets::DefaultNaturalPatches());
if (gen->Initialize(a_IniFile, "DirtPockets"))
{
m_FinishGens.push_back(gen);
@@ -343,12 +339,12 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
}
else if (NoCaseCompare(finisher, "DistortedMembraneOverhangs") == 0)
{
- m_FinishGens.push_back(cFinishGenPtr(new cStructGenDistortedMembraneOverhangs(Seed)));
+ m_FinishGens.push_back(cFinishGenPtr(new cStructGenDistortedMembraneOverhangs(m_Seed)));
}
else if (NoCaseCompare(finisher, "DualRidgeCaves") == 0)
{
float Threshold = static_cast<float>(a_IniFile.GetValueSetF("Generator", "DualRidgeCavesThreshold", 0.3));
- m_FinishGens.push_back(cFinishGenPtr(new cStructGenDualRidgeCaves(Seed, Threshold)));
+ m_FinishGens.push_back(cFinishGenPtr(new cStructGenDualRidgeCaves(m_Seed, Threshold)));
}
else if (NoCaseCompare(finisher, "DungeonRooms") == 0)
{
@@ -356,11 +352,11 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
int MaxSize = a_IniFile.GetValueSetI("Generator", "DungeonRoomsMaxSize", 7);
int MinSize = a_IniFile.GetValueSetI("Generator", "DungeonRoomsMinSize", 5);
AString HeightDistrib = a_IniFile.GetValueSet ("Generator", "DungeonRoomsHeightDistrib", "0, 0; 10, 10; 11, 500; 40, 500; 60, 40; 90, 1");
- m_FinishGens.push_back(cFinishGenPtr(new cDungeonRoomsFinisher(m_ShapeGen, Seed, GridSize, MaxSize, MinSize, HeightDistrib)));
+ m_FinishGens.push_back(cFinishGenPtr(new cDungeonRoomsFinisher(m_ShapeGen, m_Seed, GridSize, MaxSize, MinSize, HeightDistrib)));
}
else if (NoCaseCompare(finisher, "GlowStone") == 0)
{
- m_FinishGens.push_back(cFinishGenPtr(new cFinishGenGlowStone(Seed)));
+ m_FinishGens.push_back(cFinishGenPtr(new cFinishGenGlowStone(m_Seed)));
}
else if (NoCaseCompare(finisher, "Ice") == 0)
{
@@ -369,11 +365,11 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
else if (NoCaseCompare(finisher, "LavaLakes") == 0)
{
int Probability = a_IniFile.GetValueSetI("Generator", "LavaLakesProbability", 10);
- m_FinishGens.push_back(cFinishGenPtr(new cStructGenLakes(Seed * 5 + 16873, E_BLOCK_STATIONARY_LAVA, m_ShapeGen, Probability)));
+ m_FinishGens.push_back(cFinishGenPtr(new cStructGenLakes(m_Seed * 5 + 16873, E_BLOCK_STATIONARY_LAVA, m_ShapeGen, Probability)));
}
else if (NoCaseCompare(finisher, "LavaSprings") == 0)
{
- m_FinishGens.push_back(cFinishGenPtr(new cFinishGenFluidSprings(Seed, E_BLOCK_LAVA, a_IniFile, Dimension)));
+ m_FinishGens.push_back(cFinishGenPtr(new cFinishGenFluidSprings(m_Seed, E_BLOCK_LAVA, a_IniFile, Dimension)));
}
else if (NoCaseCompare(finisher, "Lilypads") == 0)
{
@@ -387,11 +383,11 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
AllowedBlocks.push_back(E_BLOCK_WATER);
AllowedBlocks.push_back(E_BLOCK_STATIONARY_WATER);
- m_FinishGens.push_back(cFinishGenPtr(new cFinishGenSingleTopBlock(Seed, E_BLOCK_LILY_PAD, AllowedBiomes, 4, AllowedBlocks)));
+ m_FinishGens.push_back(cFinishGenPtr(new cFinishGenSingleTopBlock(m_Seed, E_BLOCK_LILY_PAD, AllowedBiomes, 4, AllowedBlocks)));
}
else if (NoCaseCompare(finisher, "MarbleCaves") == 0)
{
- m_FinishGens.push_back(cFinishGenPtr(new cStructGenMarbleCaves(Seed)));
+ m_FinishGens.push_back(cFinishGenPtr(new cStructGenMarbleCaves(m_Seed)));
}
else if (NoCaseCompare(finisher, "MineShafts") == 0)
{
@@ -402,22 +398,22 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
int ChanceCrossing = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceCrossing", 200);
int ChanceStaircase = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceStaircase", 200);
m_FinishGens.push_back(cFinishGenPtr(new cStructGenMineShafts(
- Seed, GridSize, MaxOffset, MaxSystemSize,
+ m_Seed, GridSize, MaxOffset, MaxSystemSize,
ChanceCorridor, ChanceCrossing, ChanceStaircase
)));
}
else if (NoCaseCompare(finisher, "NaturalPatches") == 0)
{
- m_FinishGens.push_back(std::make_shared<cFinishGenOreNests>(Seed + 1, cFinishGenOreNests::DefaultNaturalPatches()));
+ m_FinishGens.push_back(std::make_shared<cFinishGenOreNests>(m_Seed + 1, cFinishGenOreNests::DefaultNaturalPatches()));
}
else if (NoCaseCompare(finisher, "NetherClumpFoliage") == 0)
{
- m_FinishGens.push_back(cFinishGenPtr(new cFinishGenNetherClumpFoliage(Seed)));
+ m_FinishGens.push_back(cFinishGenPtr(new cFinishGenNetherClumpFoliage(m_Seed)));
}
else if (NoCaseCompare(*itr, "NetherForts") == 0)
{
LOGINFO("The NetherForts finisher is obsolete, you should use \"PieceStructures: NetherFort\" instead.");
- auto gen = std::make_shared<cPieceStructuresGen>(Seed);
+ auto gen = std::make_shared<cPieceStructuresGen>(m_Seed);
if (gen->Initialize("NetherFort", seaLevel, m_BiomeGen, m_CompositedHeightCache))
{
m_FinishGens.push_back(gen);
@@ -425,15 +421,15 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
}
else if (NoCaseCompare(finisher, "NetherOreNests") == 0)
{
- m_FinishGens.push_back(std::make_shared<cFinishGenOreNests>(Seed + 2, cFinishGenOreNests::DefaultNetherOres()));
+ m_FinishGens.push_back(std::make_shared<cFinishGenOreNests>(m_Seed + 2, cFinishGenOreNests::DefaultNetherOres()));
}
else if (NoCaseCompare(finisher, "OreNests") == 0)
{
- m_FinishGens.push_back(std::make_shared<cFinishGenOreNests>(Seed + 3, cFinishGenOreNests::DefaultOverworldOres()));
+ m_FinishGens.push_back(std::make_shared<cFinishGenOreNests>(m_Seed + 3, cFinishGenOreNests::DefaultOverworldOres()));
}
else if (NoCaseCompare(finisher, "OrePockets") == 0)
{
- auto gen = std::make_shared<cFinishGenOrePockets>(Seed + 2, cFinishGenOrePockets::DefaultOverworldOres());
+ auto gen = std::make_shared<cFinishGenOrePockets>(m_Seed + 2, cFinishGenOrePockets::DefaultOverworldOres());
if (gen->Initialize(a_IniFile, "OrePockets"))
{
m_FinishGens.push_back(gen);
@@ -442,7 +438,7 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
else if (NoCaseCompare(finisher, "OverworldClumpFlowers") == 0)
{
auto flowers = cFinishGenClumpTopBlock::ParseIniFile(a_IniFile, "OverworldClumpFlowers");
- m_FinishGens.push_back(cFinishGenPtr(new cFinishGenClumpTopBlock(Seed, flowers)));
+ m_FinishGens.push_back(cFinishGenPtr(new cFinishGenClumpTopBlock(m_Seed, flowers)));
}
else if (NoCaseCompare(finisher, "PieceStructures") == 0)
{
@@ -452,7 +448,7 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
continue;
}
- auto gen = std::make_shared<cPieceStructuresGen>(Seed);
+ auto gen = std::make_shared<cPieceStructuresGen>(m_Seed);
if (gen->Initialize(split[1], seaLevel, m_BiomeGen, m_CompositedHeightCache))
{
m_FinishGens.push_back(gen);
@@ -470,7 +466,7 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
else if (NoCaseCompare(finisher, "RainbowRoads") == 0)
{
LOGINFO("The RainbowRoads finisher is obsolete, you should use \"PieceStructures: RainbowRoads\" instead.");
- auto gen = std::make_shared<cPieceStructuresGen>(Seed);
+ auto gen = std::make_shared<cPieceStructuresGen>(m_Seed);
if (gen->Initialize("RainbowRoads", seaLevel, m_BiomeGen, m_CompositedHeightCache))
{
m_FinishGens.push_back(gen);
@@ -478,7 +474,7 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
}
else if (NoCaseCompare(finisher, "Ravines") == 0)
{
- m_FinishGens.push_back(cFinishGenPtr(new cStructGenRavines(Seed, 128)));
+ m_FinishGens.push_back(cFinishGenPtr(new cStructGenRavines(m_Seed, 128)));
}
else if (NoCaseCompare(finisher, "RoughRavines") == 0)
{
@@ -499,7 +495,7 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
double MaxCeilingHeightCenter = a_IniFile.GetValueSetF("Generator", "RoughRavinesMaxCeilingHeightCenter", 58);
double MinCeilingHeightCenter = a_IniFile.GetValueSetF("Generator", "RoughRavinesMinCeilingHeightCenter", 36);
m_FinishGens.push_back(cFinishGenPtr(new cRoughRavines(
- Seed, MaxSize, MinSize,
+ m_Seed, MaxSize, MinSize,
static_cast<float>(MaxCenterWidth),
static_cast<float>(MinCenterWidth),
static_cast<float>(MaxRoughness),
@@ -517,7 +513,7 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
}
else if (NoCaseCompare(finisher, "SoulsandRims") == 0)
{
- m_FinishGens.push_back(cFinishGenPtr(new cFinishGenSoulsandRims(Seed)));
+ m_FinishGens.push_back(cFinishGenPtr(new cFinishGenSoulsandRims(m_Seed)));
}
else if (NoCaseCompare(finisher, "Snow") == 0)
{
@@ -527,20 +523,20 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
{
int MaxCactusHeight = a_IniFile.GetValueI("Plants", "MaxCactusHeight", 3);
int MaxSugarcaneHeight = a_IniFile.GetValueI("Plants", "MaxSugarcaneHeight", 3);
- m_FinishGens.push_back(std::make_shared<cFinishGenSprinkleFoliage>(Seed, MaxCactusHeight, MaxSugarcaneHeight));
+ m_FinishGens.push_back(std::make_shared<cFinishGenSprinkleFoliage>(m_Seed, MaxCactusHeight, MaxSugarcaneHeight));
}
else if (NoCaseCompare(finisher, "TallGrass") == 0)
{
- m_FinishGens.push_back(cFinishGenPtr(new cFinishGenTallGrass(Seed)));
+ m_FinishGens.push_back(cFinishGenPtr(new cFinishGenTallGrass(m_Seed)));
}
else if (NoCaseCompare(finisher, "Trees") == 0)
{
- m_FinishGens.push_back(cFinishGenPtr(new cStructGenTrees(Seed, m_BiomeGen, m_ShapeGen, m_CompositionGen)));
+ m_FinishGens.push_back(cFinishGenPtr(new cStructGenTrees(m_Seed, m_BiomeGen, m_ShapeGen, m_CompositionGen)));
}
else if (NoCaseCompare(finisher, "UnderwaterBases") == 0)
{
LOGINFO("The UnderwaterBases finisher is obsolete, you should use \"PieceStructures: UnderwaterBases\" instead.");
- auto gen = std::make_shared<cPieceStructuresGen>(Seed);
+ auto gen = std::make_shared<cPieceStructuresGen>(m_Seed);
if (gen->Initialize("UnderwaterBases", seaLevel, m_BiomeGen, m_CompositedHeightCache))
{
m_FinishGens.push_back(gen);
@@ -556,28 +552,28 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
int MaxDensity = a_IniFile.GetValueSetI("Generator", "VillageMaxDensity", 80);
AString PrefabList = a_IniFile.GetValueSet("Generator", "VillagePrefabs", "PlainsVillage, SandVillage");
auto Prefabs = StringSplitAndTrim(PrefabList, ",");
- m_FinishGens.push_back(std::make_shared<cVillageGen>(Seed, GridSize, MaxOffset, MaxDepth, MaxSize, MinDensity, MaxDensity, m_BiomeGen, m_CompositedHeightCache, seaLevel, Prefabs));
+ m_FinishGens.push_back(std::make_shared<cVillageGen>(m_Seed, GridSize, MaxOffset, MaxDepth, MaxSize, MinDensity, MaxDensity, m_BiomeGen, m_CompositedHeightCache, seaLevel, Prefabs));
}
else if (NoCaseCompare(finisher, "Vines") == 0)
{
int Level = a_IniFile.GetValueSetI("Generator", "VinesLevel", 40);
- m_FinishGens.push_back(std::make_shared<cFinishGenVines>(Seed, Level));
+ m_FinishGens.push_back(std::make_shared<cFinishGenVines>(m_Seed, Level));
}
else if (NoCaseCompare(finisher, "WaterLakes") == 0)
{
int Probability = a_IniFile.GetValueSetI("Generator", "WaterLakesProbability", 25);
- m_FinishGens.push_back(cFinishGenPtr(new cStructGenLakes(Seed * 3 + 652, E_BLOCK_STATIONARY_WATER, m_ShapeGen, Probability)));
+ m_FinishGens.push_back(cFinishGenPtr(new cStructGenLakes(m_Seed * 3 + 652, E_BLOCK_STATIONARY_WATER, m_ShapeGen, Probability)));
}
else if (NoCaseCompare(finisher, "WaterSprings") == 0)
{
- m_FinishGens.push_back(cFinishGenPtr(new cFinishGenFluidSprings(Seed, E_BLOCK_WATER, a_IniFile, Dimension)));
+ m_FinishGens.push_back(cFinishGenPtr(new cFinishGenFluidSprings(m_Seed, E_BLOCK_WATER, a_IniFile, Dimension)));
}
else if (NoCaseCompare(finisher, "WormNestCaves") == 0)
{
int Size = a_IniFile.GetValueSetI("Generator", "WormNestCavesSize", 64);
int Grid = a_IniFile.GetValueSetI("Generator", "WormNestCavesGrid", 96);
int MaxOffset = a_IniFile.GetValueSetI("Generator", "WormNestMaxOffset", 32);
- m_FinishGens.push_back(cFinishGenPtr(new cStructGenWormNestCaves(Seed, Size, Grid, MaxOffset)));
+ m_FinishGens.push_back(cFinishGenPtr(new cStructGenWormNestCaves(m_Seed, Size, Grid, MaxOffset)));
}
else
{