diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-14 19:06:21 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-10-14 19:06:21 +0200 |
commit | 5b7de82a79e3f18affcffd686484a681d187942a (patch) | |
tree | 3a0b766fd827de634456bee9ea9ce225f40bfb60 /source/Simulator/FireSimulator.cpp | |
parent | Biomal CompoGen now generates sea with STATIONARY_WATER instead of regular WATER. (diff) | |
download | cuberite-5b7de82a79e3f18affcffd686484a681d187942a.tar cuberite-5b7de82a79e3f18affcffd686484a681d187942a.tar.gz cuberite-5b7de82a79e3f18affcffd686484a681d187942a.tar.bz2 cuberite-5b7de82a79e3f18affcffd686484a681d187942a.tar.lz cuberite-5b7de82a79e3f18affcffd686484a681d187942a.tar.xz cuberite-5b7de82a79e3f18affcffd686484a681d187942a.tar.zst cuberite-5b7de82a79e3f18affcffd686484a681d187942a.zip |
Diffstat (limited to 'source/Simulator/FireSimulator.cpp')
-rw-r--r-- | source/Simulator/FireSimulator.cpp | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/source/Simulator/FireSimulator.cpp b/source/Simulator/FireSimulator.cpp index c2f22668b..1f20b0497 100644 --- a/source/Simulator/FireSimulator.cpp +++ b/source/Simulator/FireSimulator.cpp @@ -47,8 +47,10 @@ void cFireSimulator::Simulate( float a_Dt ) if(!IsAllowedBlock(BlockID)) //Check wheather the block is still burning continue; - if(BurnBlockAround(Pos.x, Pos.y, Pos.z)) //Burn single block and if there was one -> next time again - _AddBlock(Pos.x, Pos.y, Pos.z); + if (BurnBlockAround(Pos.x, Pos.y, Pos.z)) //Burn single block and if there was one -> next time again + { + m_Blocks->push_back(Pos); + } else if(!IsForeverBurnable(m_World->GetBlock(Pos.x, Pos.y - 1, Pos.z)) && !FiresForever(BlockID)) m_World->SetBlock(Pos.x, Pos.y, Pos.z, E_BLOCK_AIR, 0); @@ -61,42 +63,34 @@ void cFireSimulator::Simulate( float a_Dt ) -bool cFireSimulator::IsAllowedBlock( BLOCKTYPE a_BlockType ) +bool cFireSimulator::IsAllowedBlock(BLOCKTYPE a_BlockType) { - return a_BlockType == E_BLOCK_FIRE - || IsBlockLava(a_BlockType); + return (a_BlockType == E_BLOCK_FIRE) || IsBlockLava(a_BlockType); } -void cFireSimulator::AddBlock(int a_X, int a_Y, int a_Z) +void cFireSimulator::AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ) { - char BlockID = m_World->GetBlock(a_X, a_Y, a_Z); - if(!IsAllowedBlock(BlockID)) //This should save very much time because it doesn´t have to iterate through all blocks + BLOCKTYPE BlockType = m_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ); + if (!IsAllowedBlock(BlockType)) + { return; + } - //check for duplicates - for( BlockList::iterator itr = m_Blocks->begin(); itr != m_Blocks->end(); ++itr ) + // Check for duplicates: + for (BlockList::iterator itr = m_Blocks->begin(); itr != m_Blocks->end(); ++itr ) { Vector3i Pos = *itr; - if( Pos.x == a_X && Pos.y == a_Y && Pos.z == a_Z ) + if ((Pos.x == a_BlockX) && (Pos.y == a_BlockY) && (Pos.z == a_BlockZ)) + { return; + } } - _AddBlock(a_X, a_Y, a_Z); - -} - - - - - -void cFireSimulator::_AddBlock(int a_X, int a_Y, int a_Z) -{ - m_Blocks->push_back( Vector3i(a_X, a_Y, a_Z) ); - + m_Blocks->push_back(Vector3i(a_BlockX, a_BlockY, a_BlockZ)); } |