summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-03-18 15:35:19 +0100
committerMattes D <github@xoft.cz>2015-03-18 15:35:19 +0100
commit49e59ee06bfaba9f47807750093fb54eaaa9cbda (patch)
tree5be6e825b3f3ddaf719384a4748c59e44b071768 /src/World.cpp
parentDebuggers: Added a cBoundingBox test. (diff)
downloadcuberite-49e59ee06bfaba9f47807750093fb54eaaa9cbda.tar
cuberite-49e59ee06bfaba9f47807750093fb54eaaa9cbda.tar.gz
cuberite-49e59ee06bfaba9f47807750093fb54eaaa9cbda.tar.bz2
cuberite-49e59ee06bfaba9f47807750093fb54eaaa9cbda.tar.lz
cuberite-49e59ee06bfaba9f47807750093fb54eaaa9cbda.tar.xz
cuberite-49e59ee06bfaba9f47807750093fb54eaaa9cbda.tar.zst
cuberite-49e59ee06bfaba9f47807750093fb54eaaa9cbda.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/World.cpp b/src/World.cpp
index f3837eb02..05eccb0fa 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -2911,6 +2911,20 @@ bool cWorld::ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback & a_
bool cWorld::DoWithEntityByID(int a_UniqueID, cEntityCallback & a_Callback)
{
+ // First check the entities-to-add:
+ {
+ cCSLock Lock(m_CSEntitiesToAdd);
+ for (auto & ent: m_EntitiesToAdd)
+ {
+ if (ent->GetUniqueID() == a_UniqueID)
+ {
+ a_Callback.Item(ent);
+ return true;
+ }
+ } // for ent - m_EntitiesToAdd[]
+ }
+
+ // Then check the chunkmap:
return m_ChunkMap->DoWithEntityByID(a_UniqueID, a_Callback);
}