2017-05-29 01:43:52 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include "PacketObjectSpawn.hpp"
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
2018-05-12 16:40:00 +00:00
|
|
|
PacketObjectSpawn::PacketObjectSpawn(RakNet::RakPeerInterface *peer) : ObjectPacket(peer)
|
2017-05-29 01:43:52 +00:00
|
|
|
{
|
|
|
|
packetID = ID_OBJECT_SPAWN;
|
2017-06-02 19:10:47 +00:00
|
|
|
hasCellData = true;
|
2017-05-29 01:43:52 +00:00
|
|
|
}
|
|
|
|
|
2018-05-12 21:42:24 +00:00
|
|
|
void PacketObjectSpawn::Object(BaseObject &baseObject, bool send)
|
2017-05-29 01:43:52 +00:00
|
|
|
{
|
2018-05-12 21:42:24 +00:00
|
|
|
ObjectPacket::Object(baseObject, send);
|
|
|
|
RW(baseObject.position, send);
|
2018-06-30 21:43:29 +00:00
|
|
|
RW(baseObject.summonDuration, send);
|
2017-05-29 01:43:52 +00:00
|
|
|
|
2018-05-12 21:42:24 +00:00
|
|
|
RW(baseObject.hasMaster, send);
|
2017-05-29 01:43:52 +00:00
|
|
|
|
2018-05-12 21:42:24 +00:00
|
|
|
if (baseObject.hasMaster)
|
2017-06-01 22:35:32 +00:00
|
|
|
{
|
2018-05-12 21:42:24 +00:00
|
|
|
RW(baseObject.master.isPlayer, send);
|
2018-04-05 09:48:53 +00:00
|
|
|
|
2018-05-12 21:42:24 +00:00
|
|
|
if (baseObject.master.isPlayer)
|
2018-04-05 09:48:53 +00:00
|
|
|
{
|
2018-05-12 21:42:24 +00:00
|
|
|
RW(baseObject.master.guid, send);
|
2018-04-05 09:48:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-05-12 21:42:24 +00:00
|
|
|
RW(baseObject.master.refId, send, 1);
|
|
|
|
RW(baseObject.master.refNumIndex, send);
|
|
|
|
RW(baseObject.master.mpNum, send);
|
2018-04-05 09:48:53 +00:00
|
|
|
}
|
2017-05-29 01:43:52 +00:00
|
|
|
}
|
|
|
|
}
|