1
0
Fork 0

Made suggested changes

This commit is contained in:
Samuel Barney 2013-12-03 19:05:34 -07:00
parent 30906a597c
commit efae54db0a
2 changed files with 11 additions and 6 deletions

View File

@ -94,9 +94,7 @@ void cFireSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChun
for (cCoordWithIntList::iterator itr = Data.begin(); itr != Data.end();)
{
int idx = cChunkDef::MakeIndexNoCheck(itr->x, itr->y, itr->z);
int idb = cChunkDef::MakeIndexNoCheck(itr->x, itr->y - 1, itr->z);
BLOCKTYPE BlockType = a_Chunk->GetBlock(idx);
BLOCKTYPE Burnee = a_Chunk->GetBlock(idb);
if (!IsAllowedBlock(BlockType))
{
@ -137,7 +135,14 @@ void cFireSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChun
itr = Data.erase(itr);
continue;
}
if(Burnee != E_BLOCK_NETHERRACK)
BLOCKTYPE Burnee = E_BLOCK_AIR;
if (itr->y > 0)
{
Burnee = a_Chunk->GetBlock(itr->x, itr->y - 1, itr->z);
}
if(!DoesBurnForever(Burnee))
{
a_Chunk->SetMeta(idx, BlockMeta + 1);
}
@ -181,7 +186,7 @@ bool cFireSimulator::IsFuel(BLOCKTYPE a_BlockType)
bool cFireSimulator::IsForever(BLOCKTYPE a_BlockType)
bool cFireSimulator::DoesBurnForever(BLOCKTYPE a_BlockType)
{
return (a_BlockType == E_BLOCK_NETHERRACK);
}
@ -230,7 +235,7 @@ int cFireSimulator::GetBurnStepTime(cChunk * a_Chunk, int a_RelX, int a_RelY, in
if (a_RelY > 0)
{
BLOCKTYPE BlockBelow = a_Chunk->GetBlock(a_RelX, a_RelY - 1, a_RelZ);
if (IsForever(BlockBelow))
if (DoesBurnForever(BlockBelow))
{
// Is burning atop of netherrack, burn forever (re-check in 10 sec)
return 10000;

View File

@ -28,7 +28,7 @@ public:
virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) override;
bool IsFuel (BLOCKTYPE a_BlockType);
bool IsForever(BLOCKTYPE a_BlockType);
bool DoesBurnForever(BLOCKTYPE a_BlockType);
protected:
/// Time (in msec) that a fire block takes to burn with a fuel block into the next step