diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index 55059b522..152fcf85c 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -278,6 +278,8 @@ namespace MWScript int index = MWBase::Environment::get().getScriptManager()->getLocalIndex (scriptId, name, 's'); + ptr.getRefData().setLocals ( + *MWBase::Environment::get().getWorld()->getStore().scripts.find (scriptId)); return ptr.getRefData().getLocals().mShorts[index]; } @@ -289,6 +291,8 @@ namespace MWScript int index = MWBase::Environment::get().getScriptManager()->getLocalIndex (scriptId, name, 'l'); + ptr.getRefData().setLocals ( + *MWBase::Environment::get().getWorld()->getStore().scripts.find (scriptId)); return ptr.getRefData().getLocals().mLongs[index]; } @@ -300,6 +304,8 @@ namespace MWScript int index = MWBase::Environment::get().getScriptManager()->getLocalIndex (scriptId, name, 'f'); + ptr.getRefData().setLocals ( + *MWBase::Environment::get().getWorld()->getStore().scripts.find (scriptId)); return ptr.getRefData().getLocals().mFloats[index]; } @@ -311,6 +317,8 @@ namespace MWScript int index = MWBase::Environment::get().getScriptManager()->getLocalIndex (scriptId, name, 's'); + ptr.getRefData().setLocals ( + *MWBase::Environment::get().getWorld()->getStore().scripts.find (scriptId)); ptr.getRefData().getLocals().mShorts[index] = value; } @@ -322,6 +330,8 @@ namespace MWScript int index = MWBase::Environment::get().getScriptManager()->getLocalIndex (scriptId, name, 'l'); + ptr.getRefData().setLocals ( + *MWBase::Environment::get().getWorld()->getStore().scripts.find (scriptId)); ptr.getRefData().getLocals().mLongs[index] = value; } @@ -333,6 +343,8 @@ namespace MWScript int index = MWBase::Environment::get().getScriptManager()->getLocalIndex (scriptId, name, 'f'); + ptr.getRefData().setLocals ( + *MWBase::Environment::get().getWorld()->getStore().scripts.find (scriptId)); ptr.getRefData().getLocals().mFloats[index] = value; } diff --git a/components/compiler/generator.cpp b/components/compiler/generator.cpp index b619ad67a..9b02e4273 100644 --- a/components/compiler/generator.cpp +++ b/components/compiler/generator.cpp @@ -794,6 +794,8 @@ namespace Compiler index = literals.addString (id); + opPushInt (code, index); + switch (localType) { case 'f': diff --git a/components/interpreter/localopcodes.hpp b/components/interpreter/localopcodes.hpp index 852fa7099..4b0edff9c 100644 --- a/components/interpreter/localopcodes.hpp +++ b/components/interpreter/localopcodes.hpp @@ -278,7 +278,6 @@ namespace Interpreter std::string variable = runtime.getStringLiteral (index); runtime.pop(); - index = runtime[0].mInteger; int value = runtime.getContext().getMemberShort (id, variable); runtime[0].mInteger = value; } @@ -296,7 +295,6 @@ namespace Interpreter std::string variable = runtime.getStringLiteral (index); runtime.pop(); - index = runtime[0].mInteger; int value = runtime.getContext().getMemberLong (id, variable); runtime[0].mInteger = value; } @@ -314,7 +312,6 @@ namespace Interpreter std::string variable = runtime.getStringLiteral (index); runtime.pop(); - index = runtime[0].mInteger; float value = runtime.getContext().getMemberFloat (id, variable); runtime[0].mFloat = value; }