summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-22 18:26:48 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-22 18:26:48 +0200
commita28b0dc1201dca7c34d9a6c33232157e45a6d4f8 (patch)
treec904fd2faa10ed724e7229749b31ad6fe37fed9b /src/Chunk.cpp
parentSuggestion and failed merge fix (diff)
downloadcuberite-a28b0dc1201dca7c34d9a6c33232157e45a6d4f8.tar
cuberite-a28b0dc1201dca7c34d9a6c33232157e45a6d4f8.tar.gz
cuberite-a28b0dc1201dca7c34d9a6c33232157e45a6d4f8.tar.bz2
cuberite-a28b0dc1201dca7c34d9a6c33232157e45a6d4f8.tar.lz
cuberite-a28b0dc1201dca7c34d9a6c33232157e45a6d4f8.tar.xz
cuberite-a28b0dc1201dca7c34d9a6c33232157e45a6d4f8.tar.zst
cuberite-a28b0dc1201dca7c34d9a6c33232157e45a6d4f8.zip
Diffstat (limited to '')
-rw-r--r--src/Chunk.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 9b9646b0c..0be61f753 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -583,19 +583,14 @@ void cChunk::Tick(float a_Dt)
m_IsDirty = (*itr)->Tick(a_Dt, *this) | m_IsDirty;
}
- // Tick all entities in this chunk (except mobs):
- for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr)
- {
- // Mobs are ticked inside cWorld::TickMobs() (as we don't have to tick them if they are far away from players)
- // Don't tick things queued to be removed
- if (!((*itr)->IsMob()))
+ for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end();)
+ {
+ if (!((*itr)->IsMob())) // Mobs are ticked inside cWorld::TickMobs() (as we don't have to tick them if they are far away from players)
{
+ // Tick all entities in this chunk (except mobs):
(*itr)->Tick(a_Dt, *this);
}
- } // for itr - m_Entitites[]
-
- for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end();)
- {
+
if ((*itr)->IsDestroyed()) // Remove all entities that were scheduled for removal:
{
LOGD("Destroying entity #%i (%s)", (*itr)->GetUniqueID(), (*itr)->GetClass());
@@ -604,7 +599,7 @@ void cChunk::Tick(float a_Dt)
itr = m_Entities.erase(itr);
delete ToDelete;
}
- else if ((*itr)->IsWorldTravellingFrom(m_World)) // Remove all entities that are travelling to another world
+ else if ((*itr)->IsWorldTravellingFrom(m_World)) // Remove all entities that are travelling to another world:
{
MarkDirty();
(*itr)->SetWorldTravellingFrom(NULL);
@@ -1899,7 +1894,7 @@ void cChunk::AddEntity(cEntity * a_Entity)
MarkDirty();
}
- ASSERT(std::find(m_Entities.begin(), m_Entities.end(), a_Entity) == m_Entities.end());
+ ASSERT(std::find(m_Entities.begin(), m_Entities.end(), a_Entity) == m_Entities.end()); // Not there already
m_Entities.push_back(a_Entity);
}