diff options
author | Mattes D <github@xoft.cz> | 2014-02-08 14:54:00 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-02-08 14:54:00 +0100 |
commit | 169b9182229ca25757b0d224915d46f481388b7a (patch) | |
tree | d19367f39bfbb8001c7a34baa176ef7d47bdeb03 /src/World.cpp | |
parent | Fixed cWorld:TryGetHeight() API. (diff) | |
parent | Fixed comment. (diff) | |
download | cuberite-169b9182229ca25757b0d224915d46f481388b7a.tar cuberite-169b9182229ca25757b0d224915d46f481388b7a.tar.gz cuberite-169b9182229ca25757b0d224915d46f481388b7a.tar.bz2 cuberite-169b9182229ca25757b0d224915d46f481388b7a.tar.lz cuberite-169b9182229ca25757b0d224915d46f481388b7a.tar.xz cuberite-169b9182229ca25757b0d224915d46f481388b7a.tar.zst cuberite-169b9182229ca25757b0d224915d46f481388b7a.zip |
Diffstat (limited to 'src/World.cpp')
-rw-r--r-- | src/World.cpp | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/src/World.cpp b/src/World.cpp index 5e08fd599..ebdd3fb06 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -29,8 +29,9 @@ #include "Simulator/FluidSimulator.h" #include "Simulator/FireSimulator.h" #include "Simulator/NoopFluidSimulator.h" +#include "Simulator/NoopRedstoneSimulator.h" #include "Simulator/SandSimulator.h" -#include "Simulator/RedstoneSimulator.h" +#include "Simulator/IncrementalRedstoneSimulator.h" #include "Simulator/VaporizeFluidSimulator.h" // Mobs: @@ -596,12 +597,11 @@ void cWorld::Start(void) m_LavaSimulator = InitializeFluidSimulator(IniFile, "Lava", E_BLOCK_LAVA, E_BLOCK_STATIONARY_LAVA); m_SandSimulator = new cSandSimulator(*this, IniFile); m_FireSimulator = new cFireSimulator(*this, IniFile); - m_RedstoneSimulator = new cRedstoneSimulator(*this); + m_RedstoneSimulator = InitializeRedstoneSimulator(IniFile); - // Water and Lava simulators get registered in InitializeFluidSimulator() + // Water, Lava and Redstone simulators get registered in their initialize function. m_SimulatorManager->RegisterSimulator(m_SandSimulator, 1); m_SimulatorManager->RegisterSimulator(m_FireSimulator, 1); - m_SimulatorManager->RegisterSimulator(m_RedstoneSimulator, 1); m_Lighting.Start(this); m_Storage.Start(this, m_StorageSchema, m_StorageCompressionFactor ); @@ -2871,6 +2871,36 @@ void cWorld::TabCompleteUserName(const AString & a_Text, AStringVector & a_Resul +cRedstoneSimulator * cWorld::InitializeRedstoneSimulator(cIniFile & a_IniFile) +{ + AString SimulatorName = a_IniFile.GetValueSet("Physics", "RedstoneSimulator", ""); + + if (SimulatorName.empty()) + { + LOGWARNING("[Physics] RedstoneSimulator not present or empty in %s, using the default of \"incremental\".", GetIniFileName().c_str()); + SimulatorName = "incremental"; + } + + cRedstoneSimulator * res = NULL; + + if (NoCaseCompare(SimulatorName, "incremental") == 0) + { + res = new cIncrementalRedstoneSimulator(*this); + } + else if (NoCaseCompare(SimulatorName, "noop") == 0) + { + res = new cRedstoneNoopSimulator(*this); + } + + m_SimulatorManager->RegisterSimulator(res, 1); + + return res; +} + + + + + cFluidSimulator * cWorld::InitializeFluidSimulator(cIniFile & a_IniFile, const char * a_FluidName, BLOCKTYPE a_SimulateBlock, BLOCKTYPE a_StationaryBlock) { AString SimulatorNameKey; |