mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-23 20:23:52 +00:00
5e6218ad6d
Disable placeholder handling of client script member variables.
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
#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);
|
|
|
|
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);
|
|
}
|
|
}
|