summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-09 01:14:42 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-09 01:14:42 +0100
commit9d1c9097e3a62f11cce94d1807c16a310eba6c2c (patch)
treef186174dd8567c9f0d43969a19782d8fdb2fb2ed /src/World.cpp
parentMerge branch 'master' into playerimprovements (diff)
parentMerge pull request #656 from mc-server/ReloadGroups (diff)
downloadcuberite-9d1c9097e3a62f11cce94d1807c16a310eba6c2c.tar
cuberite-9d1c9097e3a62f11cce94d1807c16a310eba6c2c.tar.gz
cuberite-9d1c9097e3a62f11cce94d1807c16a310eba6c2c.tar.bz2
cuberite-9d1c9097e3a62f11cce94d1807c16a310eba6c2c.tar.lz
cuberite-9d1c9097e3a62f11cce94d1807c16a310eba6c2c.tar.xz
cuberite-9d1c9097e3a62f11cce94d1807c16a310eba6c2c.tar.zst
cuberite-9d1c9097e3a62f11cce94d1807c16a310eba6c2c.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp40
1 files changed, 36 insertions, 4 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 04dda0d65..d2523b0a5 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:
@@ -247,11 +248,13 @@ cWorld::cWorld(const AString & a_WorldName) :
m_SkyDarkness(0),
m_Weather(eWeather_Sunny),
m_WeatherInterval(24000), // Guaranteed 1 day of sunshine at server start :)
+ m_Scoreboard(this),
m_GeneratorCallbacks(*this),
m_TickThread(*this),
m_Scoreboard(this),
m_bCommandBlocksEnabled(false),
m_bUseChatPrefixes(true)
+ m_TickThread(*this)
{
LOGD("cWorld::cWorld(\"%s\")", a_WorldName.c_str());
@@ -599,12 +602,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 );
@@ -2874,6 +2876,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;