From 9c5f51917a457b42d01ad5b6522cb15110d182a8 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 29 Apr 2015 16:26:46 -0700 Subject: [PATCH] declare EntitySimulation::getEntitiesToDelete() --- libraries/entities/src/EntitySimulation.cpp | 11 ++++++----- libraries/entities/src/EntitySimulation.h | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libraries/entities/src/EntitySimulation.cpp b/libraries/entities/src/EntitySimulation.cpp index da08e5cd76..bd1dbcc63e 100644 --- a/libraries/entities/src/EntitySimulation.cpp +++ b/libraries/entities/src/EntitySimulation.cpp @@ -160,15 +160,15 @@ void EntitySimulation::removeEntity(EntityItem* entity) { _entitiesToUpdate.remove(entity); _mortalEntities.remove(entity); _entitiesToSort.remove(entity); - if (entity->_tree) { - // the tree still references this entity, but it's being removed from this simulation + if (entity->_element) { + // some EntityTreeElement still references this entity, but it's being removed from this simulation _entitiesToDelete.remove(entity); removeEntityInternal(entity); } else { // we're the last to reference this entity, so we really need to delete it deleteEntityInternal(entity); } - } else if (!entity->_tree) { + } else if (!entity->_element) { // nothing else is referencing this entity, so we delete it now delete entity; } @@ -182,8 +182,8 @@ void EntitySimulation::deleteEntity(EntityItem* entity) { _entitiesToSort.remove(entity); deleteEntityInternal(entity); } else { - if (entity->_tree) { - // the tree still references this entity, so we put it on the list + if (entity->_element) { + // some EntityTreeElement still references this entity, so we put it on the list // which will be harvested by the tree later _entitiesToDelete.insert(entity); } else { @@ -246,3 +246,4 @@ void EntitySimulation::clearEntities() { _entitiesToSort.clear(); clearEntitiesInternal(); } + diff --git a/libraries/entities/src/EntitySimulation.h b/libraries/entities/src/EntitySimulation.h index a145b3cc80..509c13a5a2 100644 --- a/libraries/entities/src/EntitySimulation.h +++ b/libraries/entities/src/EntitySimulation.h @@ -70,6 +70,8 @@ public: EntityTree* getEntityTree() { return _entityTree; } + void getEntitiesToDelete(SetOfEntities& entitiesToDelete); + signals: void entityCollisionWithEntity(const EntityItemID& idA, const EntityItemID& idB, const Collision& collision);