summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorSTRWarrior <niels.breuker@hotmail.nl>2014-02-07 22:13:55 +0100
committerSTRWarrior <niels.breuker@hotmail.nl>2014-02-07 22:13:55 +0100
commit176664810b43a839d92418b2558359e61b700935 (patch)
tree4da6ba38d7d55346611186922f58cb2e7bdd607f /src/World.cpp
parentWebAdmin is stopped properly on server shutdown / restart. (diff)
downloadcuberite-176664810b43a839d92418b2558359e61b700935.tar
cuberite-176664810b43a839d92418b2558359e61b700935.tar.gz
cuberite-176664810b43a839d92418b2558359e61b700935.tar.bz2
cuberite-176664810b43a839d92418b2558359e61b700935.tar.lz
cuberite-176664810b43a839d92418b2558359e61b700935.tar.xz
cuberite-176664810b43a839d92418b2558359e61b700935.tar.zst
cuberite-176664810b43a839d92418b2558359e61b700935.zip
Diffstat (limited to '')
-rw-r--r--src/World.cpp40
1 files changed, 37 insertions, 3 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 5e08fd599..1343d5ad6 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -29,6 +29,7 @@
#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/VaporizeFluidSimulator.h"
@@ -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 InitializeFluidSimulator()
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,40 @@ void cWorld::TabCompleteUserName(const AString & a_Text, AStringVector & a_Resul
+cRedstoneManager * 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 \"Floody\".", GetIniFileName().c_str());
+ SimulatorName = "redstone";
+ }
+
+ cRedstoneManager * res = NULL;
+
+ if (
+ (NoCaseCompare(SimulatorName, "redstone") == 0)
+ )
+ {
+ res = new cRedstoneSimulator(*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;