From d6324d71bf4a7e2ba0f8000c646ec8d1cf9ed939 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 17 Jul 2013 21:39:21 -0700 Subject: [PATCH] Ensure mechanics actors/objects are cleared before adding them --- apps/openmw/mwmechanics/actors.cpp | 2 ++ apps/openmw/mwmechanics/objects.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 7af7e063c..f55b00094 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -170,6 +170,8 @@ namespace MWMechanics // erase previous death events since we are currently only tracking them while in an active cell MWWorld::Class::get(ptr).getCreatureStats(ptr).clearHasDied(); + removeActor(ptr); + MWRender::Animation *anim = MWBase::Environment::get().getWorld()->getAnimation(ptr); mActors.insert(std::make_pair(ptr, new CharacterController(ptr, anim))); } diff --git a/apps/openmw/mwmechanics/objects.cpp b/apps/openmw/mwmechanics/objects.cpp index deebd8b39..e0c0c756b 100644 --- a/apps/openmw/mwmechanics/objects.cpp +++ b/apps/openmw/mwmechanics/objects.cpp @@ -16,6 +16,8 @@ Objects::Objects() void Objects::addObject(const MWWorld::Ptr& ptr) { + removeObject(ptr); + MWRender::Animation *anim = MWBase::Environment::get().getWorld()->getAnimation(ptr); if(anim) mObjects.insert(std::make_pair(ptr, new CharacterController(ptr, anim))); }