1
0

Small performance improvements in fluid simulator.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1276 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2013-03-14 21:56:01 +00:00
parent a710fcc9a4
commit 6f883cba2d
4 changed files with 41 additions and 31 deletions

View File

@@ -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));
}