2020-02-05 15:41:48 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include "PacketClientScriptLocal.hpp"
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
|
|
|
PacketClientScriptLocal::PacketClientScriptLocal(RakNet::RakPeerInterface *peer) : ObjectPacket(peer)
|
|
|
|
{
|
|
|
|
packetID = ID_CLIENT_SCRIPT_LOCAL;
|
|
|
|
hasCellData = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PacketClientScriptLocal::Object(BaseObject &baseObject, bool send)
|
|
|
|
{
|
|
|
|
ObjectPacket::Object(baseObject, send);
|
2020-02-10 05:58:35 +00:00
|
|
|
|
2020-06-06 11:58:51 +00:00
|
|
|
uint32_t clientLocalsCount;
|
|
|
|
|
|
|
|
if (send)
|
|
|
|
clientLocalsCount = static_cast<uint32_t>(baseObject.clientLocals.size());
|
|
|
|
|
|
|
|
RW(clientLocalsCount, send);
|
|
|
|
|
|
|
|
if (!send)
|
|
|
|
{
|
|
|
|
baseObject.clientLocals.clear();
|
|
|
|
baseObject.clientLocals.resize(clientLocalsCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto&& clientLocal : baseObject.clientLocals)
|
|
|
|
{
|
|
|
|
RW(clientLocal.internalIndex, send);
|
|
|
|
RW(clientLocal.variableType, send);
|
|
|
|
|
|
|
|
if (clientLocal.variableType == mwmp::VARIABLE_TYPE::SHORT || clientLocal.variableType == mwmp::VARIABLE_TYPE::LONG)
|
|
|
|
RW(clientLocal.intValue, send);
|
|
|
|
else if (clientLocal.variableType == mwmp::VARIABLE_TYPE::FLOAT)
|
|
|
|
RW(clientLocal.floatValue, send);
|
|
|
|
}
|
2020-02-05 15:41:48 +00:00
|
|
|
}
|