mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:53:50 +00:00
Send ID_SCRIPT_MEMBER_SHORT from MWScript::InterpreterContext
This commit is contained in:
parent
d5fca115f7
commit
fff6833950
2 changed files with 20 additions and 3 deletions
|
@ -933,13 +933,12 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
|
||||||
ptrFound.getCellRef().getRefId().c_str(),
|
ptrFound.getCellRef().getRefId().c_str(),
|
||||||
ptrFound.getCellRef().getRefNum());
|
ptrFound.getCellRef().getRefNum());
|
||||||
|
|
||||||
ptrFound.getRefData().getLocals().mShorts.at(event->index) = event->shortVal;
|
|
||||||
std::string scriptId = ptrFound.getClass().getScript(ptrFound);
|
std::string scriptId = ptrFound.getClass().getScript(ptrFound);
|
||||||
|
|
||||||
ptrFound.getRefData().setLocals(
|
ptrFound.getRefData().setLocals(
|
||||||
*MWBase::Environment::get().getWorld()->getStore().get<ESM::Script>().find(scriptId));
|
*MWBase::Environment::get().getWorld()->getStore().get<ESM::Script>().find(scriptId));
|
||||||
|
|
||||||
ptrFound.getRefData().getLocals().mShorts[event->index] = event->shortVal;;
|
ptrFound.getRefData().getLocals().mShorts.at(event->index) = event->shortVal;;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -603,7 +603,25 @@ namespace MWScript
|
||||||
|
|
||||||
Locals& locals = getMemberLocals (scriptId, global);
|
Locals& locals = getMemberLocals (scriptId, global);
|
||||||
|
|
||||||
locals.mShorts[findLocalVariableIndex (scriptId, name, 's')] = value;
|
// Added by tes3mp so it can be reused by it
|
||||||
|
int index = findLocalVariableIndex(scriptId, name, 's');
|
||||||
|
|
||||||
|
locals.mShorts[index] = value;
|
||||||
|
|
||||||
|
// Added by tes3mp
|
||||||
|
if (sendPackets && !global)
|
||||||
|
{
|
||||||
|
mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent();
|
||||||
|
event->cellRef.mRefID = id;
|
||||||
|
event->varName = name;
|
||||||
|
event->shortVal = value;
|
||||||
|
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_SCRIPT_MEMBER_SHORT)->Send(event);
|
||||||
|
|
||||||
|
printf("Sending ID_SCRIPT_MEMBER_SHORT\n- cellRef: %s\n- index: %i\n- shortVal: %i\n",
|
||||||
|
event->cellRef.mRefID.c_str(),
|
||||||
|
event->index,
|
||||||
|
event->shortVal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterpreterContext::setMemberLong (const std::string& id, const std::string& name, int value, bool global)
|
void InterpreterContext::setMemberLong (const std::string& id, const std::string& name, int value, bool global)
|
||||||
|
|
Loading…
Reference in a new issue