From 984b586bb1602794b918a65ca52af06ec675b2f0 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Wed, 15 Oct 2014 16:27:03 +0200 Subject: [PATCH] fix for implicit references --- apps/openmw/mwscript/ref.hpp | 4 ++++ apps/openmw/mwscript/statsextensions.cpp | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwscript/ref.hpp b/apps/openmw/mwscript/ref.hpp index 9fb713539..18f7453e4 100644 --- a/apps/openmw/mwscript/ref.hpp +++ b/apps/openmw/mwscript/ref.hpp @@ -16,6 +16,8 @@ namespace MWScript { struct ExplicitRef { + static const bool implicit = false; + MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true, bool activeOnly = false) const { @@ -31,6 +33,8 @@ namespace MWScript struct ImplicitRef { + static const bool implicit = true; + MWWorld::Ptr operator() (Interpreter::Runtime& runtime, bool required=true, bool activeOnly = false) const { diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index 9980ab0fb..170c5fe94 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -217,7 +217,7 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { - int peek = runtime[0].mInteger; + int peek = R::implicit ? 0 : runtime[0].mInteger; MWWorld::Ptr ptr = R()(runtime); @@ -225,7 +225,8 @@ namespace MWScript runtime.pop(); // workaround broken endgame scripts that kill dagoth ur - if (Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "dagoth_ur_1")) + if (!R::implicit && + Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "dagoth_ur_1")) { runtime.push (peek);