From 8866a28cf835fd3f814d4413ab2b5883999e2065 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Wed, 27 Sep 2017 22:22:15 +0100 Subject: Fix explosion interaction with block entities. (#4052) * WriteBlockArea: Fix erasing of block entities. * cChunkMap::DoExplosionAt destroys block entities --- src/Chunk.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Chunk.cpp') diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 0ce18c45e..8d88ed3a4 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -452,14 +452,15 @@ void cChunk::WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlock } // for y // Erase all affected block entities: - cCuboid affectedArea( - {OffX, a_MinBlockY, OffZ}, - {OffX + SizeX - 1, a_MinBlockY + SizeY - 1, OffZ + SizeZ - 1} + cCuboid affectedArea( // In world coordinates + {BlockStartX, a_MinBlockY, BlockStartZ}, + {BlockEndX, a_MinBlockY + SizeY - 1, BlockEndZ} ); for (auto itr = m_BlockEntities.begin(); itr != m_BlockEntities.end();) { if (affectedArea.IsInside(itr->second->GetPos())) { + delete itr->second; itr = m_BlockEntities.erase(itr); } else -- cgit v1.2.3