summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-12 13:28:06 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-12 13:28:06 +0200
commitbee615b75b3cd98335beaa8f5a6c4487ccccb0fd (patch)
tree26180f7088ee6ad69832f7af46182606a8c66489 /src/World.cpp
parentFixed many right click issues. (diff)
parentFixed a redstone sim failure with droppers. (diff)
downloadcuberite-bee615b75b3cd98335beaa8f5a6c4487ccccb0fd.tar
cuberite-bee615b75b3cd98335beaa8f5a6c4487ccccb0fd.tar.gz
cuberite-bee615b75b3cd98335beaa8f5a6c4487ccccb0fd.tar.bz2
cuberite-bee615b75b3cd98335beaa8f5a6c4487ccccb0fd.tar.lz
cuberite-bee615b75b3cd98335beaa8f5a6c4487ccccb0fd.tar.xz
cuberite-bee615b75b3cd98335beaa8f5a6c4487ccccb0fd.tar.zst
cuberite-bee615b75b3cd98335beaa8f5a6c4487ccccb0fd.zip
Diffstat (limited to '')
-rw-r--r--src/World.cpp36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 351dded24..e9af01b8f 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -757,6 +757,11 @@ void cWorld::InitialiseGeneratorDefaults(cIniFile & a_IniFile)
a_IniFile.GetValueSet("Generator", "BottomLavaHeight", "30");
break;
}
+ case dimNotSet:
+ {
+ ASSERT(!"Dimension not set");
+ break;
+ }
}
}
@@ -772,6 +777,7 @@ void cWorld::InitialiseAndLoadMobSpawningValues(cIniFile & a_IniFile)
case dimOverworld: DefaultMonsters = "bat, cavespider, chicken, cow, creeper, enderman, horse, mooshroom, ocelot, pig, sheep, silverfish, skeleton, slime, spider, squid, wolf, zombie"; break;
case dimNether: DefaultMonsters = "blaze, ghast, magmacube, skeleton, zombie, zombiepigman"; break;
case dimEnd: DefaultMonsters = "enderman"; break;
+ case dimNotSet: ASSERT(!"Dimension not set"); break;
}
m_bAnimals = a_IniFile.GetValueSetB("Monsters", "AnimalsOn", true);
@@ -876,7 +882,7 @@ void cWorld::Tick(float a_Dt, int a_LastTickDurationMSec)
m_TimeOfDaySecs -= 1200.0;
}
- m_TimeOfDay = (Int64)(m_TimeOfDaySecs * 20.0);
+ m_TimeOfDay = static_cast<int>(m_TimeOfDaySecs * 20.0);
// Updates the sky darkness based on current time of day
UpdateSkyDarkness();
@@ -1130,7 +1136,7 @@ void cWorld::UpdateSkyDarkness(void)
}
else if (TempTime <= TIME_NIGHT_START)
{
- m_SkyDarkness = (TIME_NIGHT_START - TempTime) / TIME_SPAWN_DIVISOR;
+ m_SkyDarkness = static_cast<NIBBLETYPE>((TIME_NIGHT_START - TempTime) / TIME_SPAWN_DIVISOR);
}
else if (TempTime <= TIME_NIGHT_END)
{
@@ -1138,7 +1144,7 @@ void cWorld::UpdateSkyDarkness(void)
}
else
{
- m_SkyDarkness = (TIME_SUNRISE - TempTime) / TIME_SPAWN_DIVISOR;
+ m_SkyDarkness = static_cast<NIBBLETYPE>((TIME_SUNRISE - TempTime) / TIME_SPAWN_DIVISOR);
}
}
@@ -1592,9 +1598,9 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
MTRand r1;
for (int i = 0; i < 60; i++)
{
- int OfsX = (r1.randInt(3) + r1.randInt(3) + r1.randInt(3) + r1.randInt(3)) / 2 - 3;
- int OfsY = r1.randInt(3) + r1.randInt(3) - 3;
- int OfsZ = (r1.randInt(3) + r1.randInt(3) + r1.randInt(3) + r1.randInt(3)) / 2 - 3;
+ int OfsX = static_cast<int>(r1.randInt(3) + r1.randInt(3) + r1.randInt(3) + r1.randInt(3)) / 2 - 3;
+ int OfsY = static_cast<int>(r1.randInt(3) + r1.randInt(3)) - 3;
+ int OfsZ = static_cast<int>(r1.randInt(3) + r1.randInt(3) + r1.randInt(3) + r1.randInt(3)) / 2 - 3;
BLOCKTYPE Ground = GetBlock(a_BlockX + OfsX, a_BlockY + OfsY, a_BlockZ + OfsZ);
if (Ground != E_BLOCK_GRASS)
{
@@ -2844,7 +2850,7 @@ bool cWorld::SetCommandBlockCommand(int a_BlockX, int a_BlockY, int a_BlockZ, co
{
AString m_Command;
public:
- cUpdateCommandBlock(const AString & a_Command) : m_Command(a_Command) {}
+ cUpdateCommandBlock(const AString & a_CallbackCommand) : m_Command(a_CallbackCommand) {}
virtual bool Item(cCommandBlockEntity * a_CommandBlock) override
{
@@ -3319,20 +3325,26 @@ cFluidSimulator * cWorld::InitializeFluidSimulator(cIniFile & a_IniFile, const c
int Falloff = a_IniFile.GetValueSetI(SimulatorSectionName, "Falloff", IsWater ? 1 : 2);
int TickDelay = a_IniFile.GetValueSetI(SimulatorSectionName, "TickDelay", IsWater ? 5 : 30);
int NumNeighborsForSource = a_IniFile.GetValueSetI(SimulatorSectionName, "NumNeighborsForSource", IsWater ? 2 : -1);
+
+ if ((Falloff > 15) || (Falloff < 0))
+ {
+ LOGWARNING("Falloff for %s simulator is out of range, assuming default of %d", a_FluidName, IsWater ? 1 : 2);
+ Falloff = IsWater ? 1 : 2;
+ }
if (NoCaseCompare(SimulatorName, "floody") == 0)
{
- res = new cFloodyFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, Falloff, TickDelay, NumNeighborsForSource);
+ res = new cFloodyFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, static_cast<NIBBLETYPE>(Falloff), TickDelay, NumNeighborsForSource);
}
else if (NoCaseCompare(SimulatorName, "vanilla") == 0)
{
- res = new cVanillaFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, Falloff, TickDelay, NumNeighborsForSource);
+ res = new cVanillaFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, static_cast<NIBBLETYPE>(Falloff), TickDelay, NumNeighborsForSource);
}
else
{
// The simulator name doesn't match anything we have, issue a warning:
LOGWARNING("%s [Physics]:%s specifies an unknown simulator, using the default \"Vanilla\".", GetIniFileName().c_str(), SimulatorNameKey.c_str());
- res = new cVanillaFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, Falloff, TickDelay, NumNeighborsForSource);
+ res = new cVanillaFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, static_cast<NIBBLETYPE>(Falloff), TickDelay, NumNeighborsForSource);
}
}
@@ -3442,9 +3454,9 @@ void cWorld::cTaskSendBlockToAllPlayers::Run(cWorld & a_World)
public cPlayerListCallback
{
public:
- cPlayerCallback(std::vector<Vector3i> & a_SendQueue, cWorld & a_World) :
+ cPlayerCallback(std::vector<Vector3i> & a_SendQueue, cWorld & a_CallbackWorld) :
m_SendQueue(a_SendQueue),
- m_World(a_World)
+ m_World(a_CallbackWorld)
{
}