From 0dab7031c025ed6fc19d881a4c7263429ba8f203 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 12 Nov 2013 02:13:36 +0100 Subject: [PATCH] Make sure effects are destroyed with the animation --- apps/openmw/mwclass/npc.cpp | 2 +- apps/openmw/mwrender/animation.cpp | 3 +++ apps/openmw/mwrender/animation.hpp | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 5fb3591ad..492157993 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -445,7 +445,7 @@ namespace MWClass skillUsageSucceeded(ptr, weapskill, 0); // Apply "On hit" enchanted weapons - std::string enchantmentName = weapon.getClass().getEnchantment(weapon); + std::string enchantmentName = !weapon.isEmpty() ? weapon.getClass().getEnchantment(weapon) : ""; if (!enchantmentName.empty()) { const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get().find( diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index d494304d1..6ef51945e 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -87,6 +87,9 @@ Animation::Animation(const MWWorld::Ptr &ptr, Ogre::SceneNode *node) Animation::~Animation() { + for (std::vector::iterator it = mEffects.begin(); it != mEffects.end(); ++it) + destroyObjectList(mInsert->getCreator(), *it); + mAnimSources.clear(); Ogre::SceneManager *sceneMgr = mInsert->getCreator(); diff --git a/apps/openmw/mwrender/animation.hpp b/apps/openmw/mwrender/animation.hpp index efc7a6a59..6653b342f 100644 --- a/apps/openmw/mwrender/animation.hpp +++ b/apps/openmw/mwrender/animation.hpp @@ -3,7 +3,6 @@ #include #include -#include #include