1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 23:49:55 +00:00
openmw-tes3mp/components/openmw-mp/Packets/World/PacketScriptMemberShort.cpp
2017-05-24 22:09:35 +03:00

40 lines
957 B
C++

#include <components/openmw-mp/NetworkMessages.hpp>
#include "PacketScriptMemberShort.hpp"
using namespace mwmp;
PacketScriptMemberShort::PacketScriptMemberShort(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
{
packetID = ID_SCRIPT_MEMBER_SHORT;
}
void PacketScriptMemberShort::Packet(RakNet::BitStream *bs, bool send)
{
WorldPacket::Packet(bs, send);
if (send)
event->worldObjectCount = (unsigned int)(event->worldObjects.size());
else
event->worldObjects.clear();
RW(event->worldObjectCount, send);
WorldObject worldObject;
for (unsigned int i = 0; i < event->worldObjectCount; i++)
{
if (send)
{
worldObject = event->worldObjects.at(i);
}
RW(worldObject.refId, send);
RW(worldObject.index, send);
RW(worldObject.shortVal, send);
if (!send)
{
event->worldObjects.push_back(worldObject);
}
}
}