From d97e9cfe7e5255df6de4a7e585668288587cfc52 Mon Sep 17 00:00:00 2001 From: MiroslavR Date: Sun, 29 Jan 2017 13:29:53 +0100 Subject: [PATCH] Fix InterpreterContext::updatePtr updating mLocals to the implicit ref's locals when interpreting a targeted global script (Fixes #3738) The interpreter context of a targeted global script would point to the target's locals instead of the global script instance's locals when the target changed cell during script execution. Credit to scrawl for the solution. --- apps/openmw/mwscript/interpretercontext.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index 210b29639..0c70b6996 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -582,7 +582,8 @@ namespace MWScript if (!mReference.isEmpty() && base == mReference) { mReference = updated; - mLocals = &mReference.getRefData().getLocals(); + if (mLocals == &base.getRefData().getLocals()) + mLocals = &mReference.getRefData().getLocals(); } } }