diff --git a/dGame/EntityManager.cpp b/dGame/EntityManager.cpp index 6759b0efb..2d3b703b8 100644 --- a/dGame/EntityManager.cpp +++ b/dGame/EntityManager.cpp @@ -499,8 +499,9 @@ void EntityManager::SerializeEntity(const Entity& entity) { } } -void EntityManager::DestructAllEntities(const SystemAddress& sysAddr) { +void EntityManager::DestructAllEntities(const SystemAddress& sysAddr, const LWOOBJID except) { for (auto* entity : m_Entities | std::views::values) { + if (entity && except != LWOOBJID_EMPTY && entity->GetObjectID() == except) continue; DestructEntity(entity, sysAddr); } } diff --git a/dGame/EntityManager.h b/dGame/EntityManager.h index 6e597af1b..1809cea48 100644 --- a/dGame/EntityManager.h +++ b/dGame/EntityManager.h @@ -56,7 +56,8 @@ public: void SerializeEntity(const Entity& entity); void ConstructAllEntities(const SystemAddress& sysAddr); - void DestructAllEntities(const SystemAddress& sysAddr); + // Takes every object away from one client, except `except` when given + void DestructAllEntities(const SystemAddress& sysAddr, LWOOBJID except = LWOOBJID_EMPTY); void SetGhostDistanceMax(float value); void SetGhostDistanceMin(float value);