1
0
Fork 0

PreSimulator: Added configurations.

You can now choose if it should pregenerate something or not
This commit is contained in:
STRWarrior 2014-07-30 13:06:48 +02:00
parent f095e770b8
commit 75b7c37755
3 changed files with 30 additions and 6 deletions

View File

@ -408,7 +408,12 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
} }
else if (NoCaseCompare(*itr, "PreSimulator") == 0) else if (NoCaseCompare(*itr, "PreSimulator") == 0)
{ {
m_FinishGens.push_back(new cFinishGenPreSimulator); // Load the settings
bool PreSimulateFallingBlocks = a_IniFile.GetValueSetB("Generator", "PreSimulatorFallingBlocks", true);
bool PreSimulateWater = a_IniFile.GetValueSetB("Generator", "PreSimulatorWater", true);
bool PreSimulateLava = a_IniFile.GetValueSetB("Generator", "PreSimulatorLava", true);
m_FinishGens.push_back(new cFinishGenPreSimulator(PreSimulateFallingBlocks, PreSimulateWater, PreSimulateLava));
} }
else if (NoCaseCompare(*itr, "RainbowRoads") == 0) else if (NoCaseCompare(*itr, "RainbowRoads") == 0)
{ {

View File

@ -555,7 +555,10 @@ void cFinishGenBottomLava::GenFinish(cChunkDesc & a_ChunkDesc)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// cFinishGenPreSimulator: // cFinishGenPreSimulator:
cFinishGenPreSimulator::cFinishGenPreSimulator(void) cFinishGenPreSimulator::cFinishGenPreSimulator(bool a_PreSimulateFallingBlocks, bool a_PreSimulateWater, bool a_PreSimulateLava) :
m_PreSimulateFallingBlocks(a_PreSimulateFallingBlocks),
m_PreSimulateWater(a_PreSimulateWater),
m_PreSimulateLava(a_PreSimulateLava)
{ {
// Nothing needed yet // Nothing needed yet
} }
@ -566,9 +569,20 @@ cFinishGenPreSimulator::cFinishGenPreSimulator(void)
void cFinishGenPreSimulator::GenFinish(cChunkDesc & a_ChunkDesc) void cFinishGenPreSimulator::GenFinish(cChunkDesc & a_ChunkDesc)
{ {
CollapseSandGravel(a_ChunkDesc.GetBlockTypes(), a_ChunkDesc.GetHeightMap()); if (m_PreSimulateFallingBlocks)
StationarizeFluid(a_ChunkDesc.GetBlockTypes(), a_ChunkDesc.GetHeightMap(), E_BLOCK_WATER, E_BLOCK_STATIONARY_WATER); {
StationarizeFluid(a_ChunkDesc.GetBlockTypes(), a_ChunkDesc.GetHeightMap(), E_BLOCK_LAVA, E_BLOCK_STATIONARY_LAVA); CollapseSandGravel(a_ChunkDesc.GetBlockTypes(), a_ChunkDesc.GetHeightMap());
}
if (m_PreSimulateWater)
{
StationarizeFluid(a_ChunkDesc.GetBlockTypes(), a_ChunkDesc.GetHeightMap(), E_BLOCK_WATER, E_BLOCK_STATIONARY_WATER);
}
if (m_PreSimulateLava)
{
StationarizeFluid(a_ChunkDesc.GetBlockTypes(), a_ChunkDesc.GetHeightMap(), E_BLOCK_LAVA, E_BLOCK_STATIONARY_LAVA);
}
// TODO: other operations // TODO: other operations
} }

View File

@ -240,9 +240,14 @@ class cFinishGenPreSimulator :
public cFinishGen public cFinishGen
{ {
public: public:
cFinishGenPreSimulator(void); cFinishGenPreSimulator(bool a_PreSimulateFallingBlocks, bool a_PreSimulateWater, bool a_PreSimulateLava);
protected: protected:
bool m_PreSimulateFallingBlocks;
bool m_PreSimulateWater;
bool m_PreSimulateLava;
// Drops hanging sand and gravel down to the ground, recalculates heightmap // Drops hanging sand and gravel down to the ground, recalculates heightmap
void CollapseSandGravel( void CollapseSandGravel(
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change