From ee1ac65e541cc8f57cca644288d560b43e20e1e0 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 15 Nov 2013 11:33:24 +0100 Subject: cChunkDesc::GetBlockEntity() re-creates block entity when blocktype doesn't match. --- source/Generating/ChunkDesc.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source/Generating/ChunkDesc.cpp') diff --git a/source/Generating/ChunkDesc.cpp b/source/Generating/ChunkDesc.cpp index 039f30d9c..9fb306996 100644 --- a/source/Generating/ChunkDesc.cpp +++ b/source/Generating/ChunkDesc.cpp @@ -535,7 +535,14 @@ cBlockEntity * cChunkDesc::GetBlockEntity(int a_RelX, int a_RelY, int a_RelZ) { if (((*itr)->GetPosX() == AbsX) && ((*itr)->GetPosY() == a_RelY) && ((*itr)->GetPosZ() == AbsZ)) { - // Already in the list, return it: + // Already in the list: + if ((*itr)->GetBlockType() != GetBlockType(a_RelX, a_RelY, a_RelZ)) + { + // Wrong type, the block type has been overwritten. Erase and create new: + m_BlockEntities.erase(itr); + break; + } + // Correct type, already present. Return it: return *itr; } } // for itr - m_BlockEntities[] -- cgit v1.2.3