diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-06-10 21:43:27 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-06-10 21:43:27 +0200 |
commit | 35b79e5d710862f957bc494638a8d8906992665d (patch) | |
tree | 1c8945ad44eed86c5c572e99b277152b2d6e90e1 /src/Chunk.cpp | |
parent | Capitalising (diff) | |
download | cuberite-35b79e5d710862f957bc494638a8d8906992665d.tar cuberite-35b79e5d710862f957bc494638a8d8906992665d.tar.gz cuberite-35b79e5d710862f957bc494638a8d8906992665d.tar.bz2 cuberite-35b79e5d710862f957bc494638a8d8906992665d.tar.lz cuberite-35b79e5d710862f957bc494638a8d8906992665d.tar.xz cuberite-35b79e5d710862f957bc494638a8d8906992665d.tar.zst cuberite-35b79e5d710862f957bc494638a8d8906992665d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Chunk.cpp | 15 |
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); } |