diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-02-01 21:49:34 +0100 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-02-03 21:50:17 +0100 |
commit | 4aade202e006738a0baf4c3190cff8ce6b91003c (patch) | |
tree | e83b2297221f3f74360304cbb4671fa8a7079722 /src/Chunk.cpp | |
parent | Merge pull request #2941 from LogicParrot/chunkBug2 (diff) | |
download | cuberite-4aade202e006738a0baf4c3190cff8ce6b91003c.tar cuberite-4aade202e006738a0baf4c3190cff8ce6b91003c.tar.gz cuberite-4aade202e006738a0baf4c3190cff8ce6b91003c.tar.bz2 cuberite-4aade202e006738a0baf4c3190cff8ce6b91003c.tar.lz cuberite-4aade202e006738a0baf4c3190cff8ce6b91003c.tar.xz cuberite-4aade202e006738a0baf4c3190cff8ce6b91003c.tar.zst cuberite-4aade202e006738a0baf4c3190cff8ce6b91003c.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Chunk.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 1e3e749fd..f5d447c45 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -1959,6 +1959,10 @@ bool cChunk::ForEachEntity(cEntityCallback & a_Callback) for (cEntityList::iterator itr = m_Entities.begin(), itr2 = itr; itr != m_Entities.end(); itr = itr2) { ++itr2; + if ((*itr)->IsDestroyed()) + { + continue; + } if (a_Callback.Item(*itr)) { return false; @@ -1977,6 +1981,10 @@ bool cChunk::ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback & a_ for (cEntityList::iterator itr = m_Entities.begin(), itr2 = itr; itr != m_Entities.end(); itr = itr2) { ++itr2; + if ((*itr)->IsDestroyed()) + { + continue; + } cBoundingBox EntBox((*itr)->GetPosition(), (*itr)->GetWidth() / 2, (*itr)->GetHeight()); if (!EntBox.DoesIntersect(a_Box)) { @@ -2000,7 +2008,7 @@ bool cChunk::DoWithEntityByID(UInt32 a_EntityID, cEntityCallback & a_Callback, b // The entity list is locked by the parent chunkmap's CS for (cEntityList::iterator itr = m_Entities.begin(), end = m_Entities.end(); itr != end; ++itr) { - if ((*itr)->GetUniqueID() == a_EntityID) + if (((*itr)->GetUniqueID() == a_EntityID) && (!(*itr)->IsDestroyed())) { a_CallbackResult = a_Callback.Item(*itr); return true; |