diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-03-14 22:56:01 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-03-14 22:56:01 +0100 |
commit | 6f883cba2d9e5089c50be3a377f4308ed3541908 (patch) | |
tree | bfbc2d78f824f9a6b2e5fc99817abd637de2f5ef /source/Simulator | |
parent | Removed the Classic fluid simulator, it was too unstable (2nd attempt) (diff) | |
download | cuberite-6f883cba2d9e5089c50be3a377f4308ed3541908.tar cuberite-6f883cba2d9e5089c50be3a377f4308ed3541908.tar.gz cuberite-6f883cba2d9e5089c50be3a377f4308ed3541908.tar.bz2 cuberite-6f883cba2d9e5089c50be3a377f4308ed3541908.tar.lz cuberite-6f883cba2d9e5089c50be3a377f4308ed3541908.tar.xz cuberite-6f883cba2d9e5089c50be3a377f4308ed3541908.tar.zst cuberite-6f883cba2d9e5089c50be3a377f4308ed3541908.zip |
Diffstat (limited to 'source/Simulator')
-rw-r--r-- | source/Simulator/DelayedFluidSimulator.cpp | 7 | ||||
-rw-r--r-- | source/Simulator/DelayedFluidSimulator.h | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/source/Simulator/DelayedFluidSimulator.cpp b/source/Simulator/DelayedFluidSimulator.cpp index f6b3e5547..25179d55a 100644 --- a/source/Simulator/DelayedFluidSimulator.cpp +++ b/source/Simulator/DelayedFluidSimulator.cpp @@ -76,18 +76,19 @@ void cDelayedFluidSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, void * ChunkDataRaw = (m_FluidBlock == E_BLOCK_WATER) ? a_Chunk->GetWaterSimulatorData() : a_Chunk->GetLavaSimulatorData();
cDelayedFluidSimulatorChunkData * ChunkData = (cDelayedFluidSimulatorChunkData *)ChunkDataRaw;
cCoordWithIntVector & Blocks = ChunkData->m_Slots[m_AddSlotNum];
-
+
// Check for duplicates:
+ int Index = cChunkDef::MakeIndexNoCheck(RelX, a_BlockY, RelZ);
for (cCoordWithIntVector::iterator itr = Blocks.begin(), end = Blocks.end(); itr != end; ++itr)
{
- if ((itr->x == RelX) && (itr->y == a_BlockY) && (itr->z == RelZ))
+ if ((itr->Data == Index))
{
return;
}
}
++m_TotalBlocks;
- Blocks.push_back(cCoordWithInt(RelX, a_BlockY, RelZ));
+ Blocks.push_back(cCoordWithInt(RelX, a_BlockY, RelZ, Index));
}
diff --git a/source/Simulator/DelayedFluidSimulator.h b/source/Simulator/DelayedFluidSimulator.h index fc1a59f69..5f8c6e073 100644 --- a/source/Simulator/DelayedFluidSimulator.h +++ b/source/Simulator/DelayedFluidSimulator.h @@ -22,7 +22,9 @@ public: cDelayedFluidSimulatorChunkData(int a_TickDelay);
virtual ~cDelayedFluidSimulatorChunkData();
- /// Slots, one for each delay tick, each containing the blocks to simulate; relative coords. Int param not used.
+ /** Slots, one for each delay tick, each containing the blocks to simulate; relative coords.
+ Int param is the block index (for faster duplicate comparison in cDelayedFluidSimulator::AddBlock())
+ */
cCoordWithIntVector * m_Slots;
} ;
|