summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2017-09-05 16:11:35 +0200
committerAlexander Harkness <me@bearbin.net>2017-09-05 16:11:35 +0200
commitef1f371dab95522343b27c5bed65ffe655666294 (patch)
treef5f8d9c9a066b2218f7403bf6d38e8819845d0e1 /src/World.cpp
parentAdded assert to cProtocolRecognizer::GetPacketId. (#4001) (diff)
downloadcuberite-ef1f371dab95522343b27c5bed65ffe655666294.tar
cuberite-ef1f371dab95522343b27c5bed65ffe655666294.tar.gz
cuberite-ef1f371dab95522343b27c5bed65ffe655666294.tar.bz2
cuberite-ef1f371dab95522343b27c5bed65ffe655666294.tar.lz
cuberite-ef1f371dab95522343b27c5bed65ffe655666294.tar.xz
cuberite-ef1f371dab95522343b27c5bed65ffe655666294.tar.zst
cuberite-ef1f371dab95522343b27c5bed65ffe655666294.zip
Diffstat (limited to 'src/World.cpp')
-rw-r--r--src/World.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/World.cpp b/src/World.cpp
index acec3049e..0ecf9a274 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -3709,6 +3709,36 @@ bool cWorld::HasEntity(UInt32 a_UniqueID)
+OwnedEntity cWorld::RemoveEntity(cEntity & a_Entity)
+{
+ // Check if the entity is in the chunkmap:
+ auto Entity = m_ChunkMap->RemoveEntity(a_Entity);
+ if (Entity != nullptr)
+ {
+ return Entity;
+ }
+
+ // Check if the entity is in the queue to be added to the world:
+ cCSLock Lock(m_CSEntitiesToAdd);
+ auto itr = std::find_if(m_EntitiesToAdd.begin(), m_EntitiesToAdd.end(),
+ [&a_Entity](const OwnedEntity & a_OwnedEntity)
+ {
+ return (a_OwnedEntity.get() == &a_Entity);
+ }
+ );
+
+ if (itr != m_EntitiesToAdd.end())
+ {
+ Entity = std::move(*itr);
+ m_EntitiesToAdd.erase(itr);
+ }
+ return Entity;
+}
+
+
+
+
+
/*
unsigned int cWorld::GetNumPlayers(void)
{