2016-10-26 09:25:50 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include "PacketScriptLocalShort.hpp"
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
|
|
|
PacketScriptLocalShort::PacketScriptLocalShort(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
|
|
|
|
{
|
|
|
|
packetID = ID_SCRIPT_LOCAL_SHORT;
|
|
|
|
}
|
|
|
|
|
2017-03-06 09:44:08 +00:00
|
|
|
void PacketScriptLocalShort::Packet(RakNet::BitStream *bs, bool send)
|
2016-10-26 09:25:50 +00:00
|
|
|
{
|
2017-03-06 09:44:08 +00:00
|
|
|
WorldPacket::Packet(bs, send);
|
2016-10-26 09:25:50 +00:00
|
|
|
|
2017-01-28 10:34:45 +00:00
|
|
|
if (!send)
|
|
|
|
event->objectChanges.objects.clear();
|
|
|
|
else
|
|
|
|
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size());
|
|
|
|
|
|
|
|
RW(event->objectChanges.count, send);
|
2016-10-26 09:25:50 +00:00
|
|
|
|
|
|
|
RW(event->cell.mData.mFlags, send);
|
|
|
|
RW(event->cell.mData.mX, send);
|
|
|
|
RW(event->cell.mData.mY, send);
|
|
|
|
RW(event->cell.mName, send);
|
|
|
|
|
2017-01-28 10:34:45 +00:00
|
|
|
WorldObject worldObject;
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < event->objectChanges.count; i++)
|
|
|
|
{
|
|
|
|
if (send)
|
|
|
|
{
|
2017-02-05 17:01:06 +00:00
|
|
|
worldObject = event->objectChanges.objects.at(i);
|
2017-01-28 10:34:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RW(worldObject.refId, send);
|
|
|
|
RW(worldObject.refNumIndex, send);
|
2017-04-04 07:16:09 +00:00
|
|
|
RW(worldObject.mpNum, send);
|
2017-01-28 10:34:45 +00:00
|
|
|
RW(worldObject.index, send);
|
|
|
|
RW(worldObject.shortVal, send);
|
|
|
|
|
|
|
|
if (!send)
|
|
|
|
{
|
|
|
|
event->objectChanges.objects.push_back(worldObject);
|
|
|
|
}
|
|
|
|
}
|
2016-10-26 09:25:50 +00:00
|
|
|
}
|