summaryrefslogtreecommitdiffstats
path: root/src/World.cpp
diff options
context:
space:
mode:
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)
{