From 63b9b075aa3e4c759a3d9d27d6a69426116b1e5b Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 26 Dec 2015 18:47:03 +0100 Subject: [PATCH] Do not allow soul trapping the same creature more than once (Fixes #3102) --- apps/openmw/mwmechanics/actors.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 7f857a700..4046010d7 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -149,14 +149,20 @@ namespace MWMechanics { MWWorld::Ptr mCreature; MWWorld::Ptr mActor; + bool mTrapped; public: SoulTrap(MWWorld::Ptr trappedCreature) - : mCreature(trappedCreature) {} + : mCreature(trappedCreature) + , mTrapped(false) + { + } virtual void visit (MWMechanics::EffectKey key, const std::string& sourceName, const std::string& sourceId, int casterActorId, float magnitude, float remainingTime = -1, float totalTime = -1) { + if (mTrapped) + return; if (key.mId != ESM::MagicEffect::Soultrap) return; if (magnitude <= 0) @@ -203,6 +209,8 @@ namespace MWMechanics gem->getContainerStore()->unstack(*gem, caster); gem->getCellRef().setSoul(mCreature.getCellRef().getRefId()); + mTrapped = true; + if (caster == getPlayer()) MWBase::Environment::get().getWindowManager()->messageBox("#{sSoultrapSuccess}");