From 9554f5be113b7f5d697a2eb8e782f70d6911be19 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 14 Oct 2012 21:29:12 +0000 Subject: Disable physics simulation for destroyed entities in Entity::reset() --- src/core/entity.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/core') diff --git a/src/core/entity.cc b/src/core/entity.cc index 6ae9e87..825f9bf 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -502,9 +502,10 @@ MenuDescription *Entity::find_menu(std::string const &label) void Entity::remove_menu(std::string const &label) { for (Menus::iterator it = menus().begin(); it != menus().end(); it++) { - if (label.compare((*it)->label()) == 0) + if (label.compare((*it)->label()) == 0) { menus().erase(it); - return; + return; + } } } @@ -702,7 +703,7 @@ void EntityDynamic::reset() } // remove Docked and Destroyed entities from the physics simulation - if ((state() == core::Entity::Docked) || (state() == core::Entity::Destroyed)) { + if (destroyed() || (state() == core::Entity::Docked) || (state() == core::Entity::Destroyed)) { if (entity_body) { @@ -1228,7 +1229,7 @@ void EntityControlable::reset() } // remove Docked and Destroyed entities from the physics simulation - if ((state() == core::Entity::Docked) || (state() == core::Entity::Destroyed)) { + if (destroyed() || (state() == core::Entity::Docked) || (state() == core::Entity::Destroyed)) { if (entity_body) { -- cgit v1.2.3