2016-10-22 15:05:32 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include "PacketObjectPlace.hpp"
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
|
|
|
PacketObjectPlace::PacketObjectPlace(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
|
|
|
|
{
|
2016-10-25 09:15:27 +00:00
|
|
|
packetID = ID_OBJECT_PLACE;
|
2016-10-22 15:05:32 +00:00
|
|
|
}
|
|
|
|
|
2017-03-06 09:44:08 +00:00
|
|
|
void PacketObjectPlace::Packet(RakNet::BitStream *bs, bool send)
|
2016-10-22 15:05:32 +00:00
|
|
|
{
|
2017-03-06 09:44:08 +00:00
|
|
|
WorldPacket::Packet(bs, send);
|
2016-10-22 15:05:32 +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-23 10:30:32 +00:00
|
|
|
|
|
|
|
RW(event->cell.mData.mFlags, send);
|
2016-10-23 13:55:30 +00:00
|
|
|
RW(event->cell.mData.mX, send);
|
|
|
|
RW(event->cell.mData.mY, send);
|
2016-10-23 10:30:32 +00:00
|
|
|
RW(event->cell.mName, send);
|
2016-10-28 19:35:01 +00:00
|
|
|
|
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 06:23:34 +00:00
|
|
|
RW(worldObject.mpNum, send);
|
2017-01-29 13:29:40 +00:00
|
|
|
RW(worldObject.count, send);
|
2017-02-17 16:34:11 +00:00
|
|
|
RW(worldObject.charge, send);
|
2017-01-28 10:34:45 +00:00
|
|
|
RW(worldObject.goldValue, send);
|
|
|
|
RW(worldObject.pos, send);
|
|
|
|
|
|
|
|
if (!send)
|
|
|
|
{
|
|
|
|
event->objectChanges.objects.push_back(worldObject);
|
|
|
|
}
|
|
|
|
}
|
2016-10-22 15:05:32 +00:00
|
|
|
}
|