From aac592f98598aae327d07b2a1bb155e33c6d51b1 Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Fri, 3 Apr 2020 22:23:38 +0100 Subject: Manage block entity lifetime with unique_ptr (#4080) --- src/SetChunkData.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/SetChunkData.cpp') diff --git a/src/SetChunkData.cpp b/src/SetChunkData.cpp index 19448147a..d27e53d1c 100644 --- a/src/SetChunkData.cpp +++ b/src/SetChunkData.cpp @@ -131,7 +131,7 @@ void cSetChunkData::RemoveInvalidBlockEntities(void) { for (cBlockEntities::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end();) { - cBlockEntity * BlockEntity = itr->second; + auto & BlockEntity = itr->second; BLOCKTYPE EntityBlockType = BlockEntity->GetBlockType(); BLOCKTYPE WorldBlockType = m_ChunkData.GetBlock({BlockEntity->GetRelX(), BlockEntity->GetPosY(), BlockEntity->GetRelZ()}); if (EntityBlockType != WorldBlockType) @@ -142,7 +142,6 @@ void cSetChunkData::RemoveInvalidBlockEntities(void) ItemTypeToString(EntityBlockType), EntityBlockType, ItemTypeToString(WorldBlockType), WorldBlockType ); - delete BlockEntity; itr = m_BlockEntities.erase(itr); } else -- cgit v1.2.3