summaryrefslogtreecommitdiffstats
path: root/src/SetChunkData.cpp
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2017-05-22 22:27:55 +0200
committerLukas Pioch <lukas@zgow.de>2017-05-22 22:27:55 +0200
commit8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e (patch)
treed29525d02edb691c25e930b0d795d0dba160a34c /src/SetChunkData.cpp
parentSpawn eggs works again (diff)
downloadcuberite-8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e.tar
cuberite-8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e.tar.gz
cuberite-8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e.tar.bz2
cuberite-8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e.tar.lz
cuberite-8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e.tar.xz
cuberite-8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e.tar.zst
cuberite-8a890cf945cfbd72f6e4b64f8c7b52d2c6ca099e.zip
Diffstat (limited to 'src/SetChunkData.cpp')
-rw-r--r--src/SetChunkData.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/SetChunkData.cpp b/src/SetChunkData.cpp
index d85f78459..cb530b3b6 100644
--- a/src/SetChunkData.cpp
+++ b/src/SetChunkData.cpp
@@ -34,7 +34,7 @@ cSetChunkData::cSetChunkData(
const cChunkDef::HeightMap * a_HeightMap,
const cChunkDef::BiomeMap * a_Biomes,
cEntityList && a_Entities,
- cBlockEntityList && a_BlockEntities,
+ cBlockEntities && a_BlockEntities,
bool a_ShouldMarkDirty
) :
m_ChunkX(a_ChunkX),
@@ -119,23 +119,21 @@ void cSetChunkData::CalculateHeightMap(void)
void cSetChunkData::RemoveInvalidBlockEntities(void)
{
- for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end();)
+ for (cBlockEntities::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end();)
{
- BLOCKTYPE EntityBlockType = (*itr)->GetBlockType();
- BLOCKTYPE WorldBlockType = cChunkDef::GetBlock(m_BlockTypes, (*itr)->GetRelX(), (*itr)->GetPosY(), (*itr)->GetRelZ());
+ cBlockEntity * BlockEntity = itr->second;
+ BLOCKTYPE EntityBlockType = BlockEntity->GetBlockType();
+ BLOCKTYPE WorldBlockType = cChunkDef::GetBlock(m_BlockTypes, BlockEntity->GetRelX(), BlockEntity->GetPosY(), BlockEntity->GetRelZ());
if (EntityBlockType != WorldBlockType)
{
// Bad blocktype, remove the block entity:
LOGD("Block entity blocktype mismatch at {%d, %d, %d}: entity for blocktype %s(%d) in block %s(%d). Deleting the block entity.",
- (*itr)->GetPosX(), (*itr)->GetPosY(), (*itr)->GetPosZ(),
+ BlockEntity->GetPosX(), BlockEntity->GetPosY(), BlockEntity->GetPosZ(),
ItemTypeToString(EntityBlockType).c_str(), EntityBlockType,
ItemTypeToString(WorldBlockType).c_str(), WorldBlockType
);
- cBlockEntityList::iterator itr2 = itr;
- ++itr2;
- delete *itr;
- m_BlockEntities.erase(itr);
- itr = itr2;
+ delete BlockEntity;
+ itr = m_BlockEntities.erase(itr);
}
else
{