From 6a22b63473d465027b8d328d2ab621c596d1ee84 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 18 Oct 2014 19:54:34 +0100 Subject: [PATCH] Furnaces now update their block entity type Therefore improving cChunk's variable boundary checking. --- src/BlockEntities/FurnaceEntity.cpp | 6 ++++-- src/Chunk.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/BlockEntities/FurnaceEntity.cpp b/src/BlockEntities/FurnaceEntity.cpp index 898d348de..284ac7de9 100644 --- a/src/BlockEntities/FurnaceEntity.cpp +++ b/src/BlockEntities/FurnaceEntity.cpp @@ -24,11 +24,11 @@ enum cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cWorld * a_World) : - super(E_BLOCK_FURNACE, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World), + super(a_BlockType, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World), m_BlockMeta(a_BlockMeta), m_CurrentRecipe(NULL), m_IsDestroyed(false), - m_IsCooking((a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_LIT_FURNACE)), + m_IsCooking(a_BlockType == E_BLOCK_LIT_FURNACE), m_NeedCookTime(0), m_TimeCooked(0), m_FuelBurnTime(0), @@ -100,6 +100,7 @@ bool cFurnaceEntity::Tick(float a_Dt, cChunk & a_Chunk) m_TimeCooked = std::max((m_TimeCooked - 2), 0); // Reset progressbars, block type, and bail out + m_BlockType = E_BLOCK_FURNACE; a_Chunk.FastSetBlock(GetRelX(), m_PosY, GetRelZ(), E_BLOCK_FURNACE, m_BlockMeta); UpdateProgressBars(); return false; @@ -368,6 +369,7 @@ void cFurnaceEntity::SetIsCooking(bool a_IsCooking) // Only light the furnace as it is extinguished only when the fuel runs out, not when cooking stops - handled in this::Tick() if (m_IsCooking) { + m_BlockType = E_BLOCK_LIT_FURNACE; m_World->FastSetBlock(m_PosX, m_PosY, m_PosZ, E_BLOCK_LIT_FURNACE, m_BlockMeta); } } diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 88ee9ba31..98c8bc66a 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -333,7 +333,7 @@ void cChunk::SetAllData(cSetChunkData & a_SetChunkData) { BLOCKTYPE EntityBlockType = (*itr)->GetBlockType(); BLOCKTYPE WorldBlockType = GetBlock((*itr)->GetRelX(), (*itr)->GetPosY(), (*itr)->GetRelZ()); - ASSERT((EntityBlockType == E_BLOCK_FURNACE) ? ((EntityBlockType == E_BLOCK_FURNACE) || (EntityBlockType == E_BLOCK_LIT_FURNACE)) : (WorldBlockType == EntityBlockType)); + ASSERT(WorldBlockType == EntityBlockType); } // for itr - m_BlockEntities #endif // _DEBUG