aboutsummaryrefslogtreecommitdiff
path: root/src/mapsector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mapsector.cpp')
-rw-r--r--src/mapsector.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mapsector.cpp b/src/mapsector.cpp
index e6cc32e28..36a61e139 100644
--- a/src/mapsector.cpp
+++ b/src/mapsector.cpp
@@ -110,6 +110,12 @@ void MapSector::insertBlock(MapBlock *block)
void MapSector::deleteBlock(MapBlock *block)
{
+ detachBlock(block);
+ delete block;
+}
+
+void MapSector::detachBlock(MapBlock *block)
+{
s16 block_y = block->getPos().Y;
// Clear from cache
@@ -118,8 +124,8 @@ void MapSector::deleteBlock(MapBlock *block)
// Remove from container
m_blocks.erase(block_y);
- // Delete
- delete block;
+ // Mark as removed
+ block->makeOrphan();
}
void MapSector::getBlocks(MapBlockVect &dest)