diff options
author | lapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-12-29 01:44:19 +0100 |
---|---|---|
committer | lapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-12-29 01:44:19 +0100 |
commit | f5466a4cb368a1554362deeb5b0f966cf5613e80 (patch) | |
tree | 6653c18a9d075ceaab4aa3a301054bcabcd23363 /source/cFireSimulator.cpp | |
parent | - little performance improvement on the sand simulator (diff) | |
download | cuberite-f5466a4cb368a1554362deeb5b0f966cf5613e80.tar cuberite-f5466a4cb368a1554362deeb5b0f966cf5613e80.tar.gz cuberite-f5466a4cb368a1554362deeb5b0f966cf5613e80.tar.bz2 cuberite-f5466a4cb368a1554362deeb5b0f966cf5613e80.tar.lz cuberite-f5466a4cb368a1554362deeb5b0f966cf5613e80.tar.xz cuberite-f5466a4cb368a1554362deeb5b0f966cf5613e80.tar.zst cuberite-f5466a4cb368a1554362deeb5b0f966cf5613e80.zip |
Diffstat (limited to 'source/cFireSimulator.cpp')
-rw-r--r-- | source/cFireSimulator.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/cFireSimulator.cpp b/source/cFireSimulator.cpp index 180ac9744..10dc8f589 100644 --- a/source/cFireSimulator.cpp +++ b/source/cFireSimulator.cpp @@ -30,13 +30,15 @@ void cFireSimulator::Simulate( float a_Dt ) {
Vector3i *Pos = *itr;
- if(!IsAllowedBlock(m_World->GetBlock(Pos->x, Pos->y, Pos->z))) //Check wheather the block is still burning
+ char BlockID = m_World->GetBlock(Pos->x, Pos->y, Pos->z);
+
+ 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);
else
- if(!IsForeverBurnable(m_World->GetBlock(Pos->x, Pos->y - 1, Pos->z)))
+ 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);
}
@@ -91,6 +93,11 @@ bool cFireSimulator::IsBurnable( char a_BlockID ) || a_BlockID == E_BLOCK_TNT;
}
+bool cFireSimulator::FiresForever( char a_BlockID )
+{
+ return a_BlockID != E_BLOCK_FIRE;
+}
+
bool cFireSimulator::BurnBlockAround(int a_X, int a_Y, int a_Z)
{
return BurnBlock(a_X + 1, a_Y, a_Z)
|