1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-07 12:54:00 +00:00

Issue #181: various fixed to member variable access

This commit is contained in:
Marc Zinnschlag 2012-06-16 13:51:13 +02:00
parent 8b19de17b6
commit 10b27e582b
3 changed files with 14 additions and 3 deletions

View File

@ -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;
}

View File

@ -794,6 +794,8 @@ namespace Compiler
index = literals.addString (id);
opPushInt (code, index);
switch (localType)
{
case 'f':

View File

@ -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;
}