summaryrefslogtreecommitdiffstats
path: root/source/Simulator/DelayedFluidSimulator.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-15 22:16:43 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-15 22:16:43 +0200
commitf9dab57d8b4b98ec0f624212452c48769c8441d1 (patch)
treed62abda0578d60686466c04c15416646c2e6c643 /source/Simulator/DelayedFluidSimulator.cpp
parentFloody fluid sim: reads params from world.ini; water and lava react together into cobblestone / stone / obsidian (diff)
downloadcuberite-f9dab57d8b4b98ec0f624212452c48769c8441d1.tar
cuberite-f9dab57d8b4b98ec0f624212452c48769c8441d1.tar.gz
cuberite-f9dab57d8b4b98ec0f624212452c48769c8441d1.tar.bz2
cuberite-f9dab57d8b4b98ec0f624212452c48769c8441d1.tar.lz
cuberite-f9dab57d8b4b98ec0f624212452c48769c8441d1.tar.xz
cuberite-f9dab57d8b4b98ec0f624212452c48769c8441d1.tar.zst
cuberite-f9dab57d8b4b98ec0f624212452c48769c8441d1.zip
Diffstat (limited to '')
-rw-r--r--source/Simulator/DelayedFluidSimulator.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/source/Simulator/DelayedFluidSimulator.cpp b/source/Simulator/DelayedFluidSimulator.cpp
index 3ace286ed..317452c57 100644
--- a/source/Simulator/DelayedFluidSimulator.cpp
+++ b/source/Simulator/DelayedFluidSimulator.cpp
@@ -17,7 +17,7 @@ cDelayedFluidSimulator::cDelayedFluidSimulator(cWorld * a_World, BLOCKTYPE a_Flu
super(a_World, a_Fluid, a_StationaryFluid),
m_TickDelay(a_TickDelay),
m_Slots(NULL),
- m_CurrentSlotNum(a_TickDelay - 1)
+ m_CurrentSlotNum(0)
{
m_Slots = new CoordsArray[a_TickDelay];
}
@@ -70,21 +70,22 @@ void cDelayedFluidSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ)
void cDelayedFluidSimulator::Simulate(float a_Dt)
{
- CoordsArray & Blocks = m_Slots[m_CurrentSlotNum];
-
- // First move to the next slot, so that simulated blocks can write another batch of scheduled blocks:
- m_CurrentSlotNum += 1;
- if (m_CurrentSlotNum >= m_TickDelay)
+ int SlotNum = m_CurrentSlotNum + 1;
+ if (SlotNum >= m_TickDelay)
{
- m_CurrentSlotNum = 0;
+ SlotNum = 0;
}
+ CoordsArray & Blocks = m_Slots[SlotNum];
+
// Simulate the blocks in the scheduled slot:
for (CoordsArray::iterator itr = Blocks.begin(), end = Blocks.end(); itr != end; ++itr)
{
SimulateBlock(itr->x, itr->y, itr->z);
}
Blocks.clear();
+
+ m_CurrentSlotNum = SlotNum;
}