From 5f349b9a6ebe355e14d389d6f2e5a94a13731fc5 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 3 Dec 2015 21:12:58 +0100 Subject: [PATCH] Support effects with attribute/skill argument in OpGetEffect --- apps/openmw/mwscript/miscextensions.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index 63f3ea190..68a30de4a 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -422,9 +422,17 @@ namespace MWScript if(key < 0 || key > 32767 || *end != '\0') key = ESM::MagicEffect::effectStringToId(effect); - runtime.push(ptr.getClass().getCreatureStats(ptr).getMagicEffects().get( - MWMechanics::EffectKey(key)).getMagnitude() > 0); - } + const MWMechanics::MagicEffects& effects = ptr.getClass().getCreatureStats(ptr).getMagicEffects(); + for (MWMechanics::MagicEffects::Collection::const_iterator it = effects.begin(); it != effects.end(); ++it) + { + if (it->first.mId == key) + { + runtime.push(1); + return; + } + } + runtime.push(0); + } }; template