Send ID_SCRIPT_MEMBER_SHORT from MWScript::InterpreterContext

pull/112/merge
David Cernat 8 years ago
parent d5fca115f7
commit fff6833950

@ -933,13 +933,12 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
ptrFound.getCellRef().getRefId().c_str(),
ptrFound.getCellRef().getRefNum());
ptrFound.getRefData().getLocals().mShorts.at(event->index) = event->shortVal;
std::string scriptId = ptrFound.getClass().getScript(ptrFound);
ptrFound.getRefData().setLocals(
*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;

@ -603,7 +603,25 @@ namespace MWScript
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)

Loading…
Cancel
Save