summaryrefslogtreecommitdiffstats
path: root/src/Simulator/FireSimulator.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-04 14:14:38 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-04 14:14:38 +0200
commit86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791 (patch)
tree1b5c702a9e9da9115e64c317bdad5aba3544d4a1 /src/Simulator/FireSimulator.cpp
parentImplemented bed homes (diff)
parentMerge pull request #1059 from mc-server/coverity_fixes (diff)
downloadcuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar
cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar.gz
cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar.bz2
cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar.lz
cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar.xz
cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.tar.zst
cuberite-86e5273cd17be8b8f1ae8a9b0dc2d212cb9b2791.zip
Diffstat (limited to 'src/Simulator/FireSimulator.cpp')
-rw-r--r--src/Simulator/FireSimulator.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Simulator/FireSimulator.cpp b/src/Simulator/FireSimulator.cpp
index 4fbfffd43..311f8b4c4 100644
--- a/src/Simulator/FireSimulator.cpp
+++ b/src/Simulator/FireSimulator.cpp
@@ -95,8 +95,10 @@ void cFireSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChun
int NumMSecs = (int)a_Dt;
for (cCoordWithIntList::iterator itr = Data.begin(); itr != Data.end();)
{
- int idx = cChunkDef::MakeIndexNoCheck(itr->x, itr->y, itr->z);
- BLOCKTYPE BlockType = a_Chunk->GetBlock(idx);
+ int x = itr->x;
+ int y = itr->y;
+ int z = itr->z;
+ BLOCKTYPE BlockType = a_Chunk->GetBlock(x,y,z);
if (!IsAllowedBlock(BlockType))
{
@@ -125,7 +127,7 @@ void cFireSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChun
itr->x + a_ChunkX * cChunkDef::Width, itr->y, itr->z + a_ChunkZ * cChunkDef::Width
);
*/
- NIBBLETYPE BlockMeta = a_Chunk->GetMeta(idx);
+ NIBBLETYPE BlockMeta = a_Chunk->GetMeta(x, y, z);
if (BlockMeta == 0x0f)
{
// The fire burnt out completely
@@ -140,7 +142,7 @@ void cFireSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChun
if((itr->y > 0) && (!DoesBurnForever(a_Chunk->GetBlock(itr->x, itr->y - 1, itr->z))))
{
- a_Chunk->SetMeta(idx, BlockMeta + 1);
+ a_Chunk->SetMeta(x, y, z, BlockMeta + 1);
}
itr->Data = GetBurnStepTime(a_Chunk, itr->x, itr->y, itr->z); // TODO: Add some randomness into this
} // for itr - Data[]