summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp38
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;