1
0

Manage block entity lifetime with unique_ptr (#4080)

This commit is contained in:
peterbell10
2020-04-03 22:23:38 +01:00
committed by GitHub
parent ba048e2101
commit aac592f985
15 changed files with 150 additions and 223 deletions

View File

@@ -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