summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r--src/Chunk.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 2850dd93b..02857ba5a 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -1859,7 +1859,20 @@ void cChunk::AddEntity(cEntity * a_Entity)
MarkDirty();
}
- ASSERT(std::find(m_Entities.begin(), m_Entities.end(), a_Entity) == m_Entities.end()); // Not there already
+ if (std::find(m_Entities.begin(), m_Entities.end(), a_Entity) != m_Entities.end())
+ {
+ // Not there already
+ std::vector<int>::iterator itr = std::find(m_EntitiesToRemove.begin(), m_EntitiesToRemove.end(), a_Entity->GetUniqueID());
+ if (itr != m_EntitiesToRemove.end())
+ {
+ m_EntitiesToRemove.erase(itr);
+ return;
+ }
+ else
+ {
+ ASSERT(!"Entity already present when AddEntity was called!");
+ }
+ }
m_Entities.push_back(a_Entity);
}