From c34314ae2671e90ded053a060f6dccc6e1aed283 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 1 Feb 2016 22:52:28 +0100 Subject: [PATCH] When an actor dies purge all spell effects cast by that actor (Fixes #3175) --- apps/openmw/mwmechanics/activespells.cpp | 4 +--- apps/openmw/mwmechanics/actors.cpp | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwmechanics/activespells.cpp b/apps/openmw/mwmechanics/activespells.cpp index 6a247622c5..c98f7d8293 100644 --- a/apps/openmw/mwmechanics/activespells.cpp +++ b/apps/openmw/mwmechanics/activespells.cpp @@ -274,9 +274,7 @@ namespace MWMechanics for (std::vector::iterator effectIt = it->second.mEffects.begin(); effectIt != it->second.mEffects.end();) { - const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().get().find(effectIt->mEffectId); - if (effect->mData.mFlags & ESM::MagicEffect::CasterLinked - && it->second.mCasterActorId == casterActorId) + if (it->second.mCasterActorId == casterActorId) effectIt = it->second.mEffects.erase(effectIt); else ++effectIt; diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 4046010d79..5d75cea35b 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -1209,7 +1209,7 @@ namespace MWMechanics ++mDeathCount[Misc::StringUtils::lowerCase(iter->first.getCellRef().getRefId())]; - // Make sure spell effects with CasterLinked flag are removed + // Make sure spell effects are removed for (PtrActorMap::iterator iter2(mActors.begin());iter2 != mActors.end();++iter2) { MWMechanics::ActiveSpells& spells = iter2->first.getClass().getCreatureStats(iter2->first).getActiveSpells();