1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 15:49:56 +00:00
openmw-tes3mp/components/openmw-mp/Packets/Object/PacketObjectSpawn.cpp

38 lines
962 B
C++

#include <components/openmw-mp/NetworkMessages.hpp>
#include "PacketObjectSpawn.hpp"
using namespace mwmp;
PacketObjectSpawn::PacketObjectSpawn(RakNet::RakPeerInterface *peer) : ObjectPacket(peer)
{
packetID = ID_OBJECT_SPAWN;
hasCellData = true;
}
void PacketObjectSpawn::Object(BaseObject &baseObject, bool send)
{
ObjectPacket::Object(baseObject, send);
RW(baseObject.position, send);
RW(baseObject.isSummon, send);
if (baseObject.isSummon)
{
RW(baseObject.summonEffectId, send);
RW(baseObject.summonSpellId, send, true);
RW(baseObject.summonDuration, send);
RW(baseObject.master.isPlayer, send);
if (baseObject.master.isPlayer)
{
RW(baseObject.master.guid, send);
}
else
{
RW(baseObject.master.refId, send, true);
RW(baseObject.master.refNum, send);
RW(baseObject.master.mpNum, send);
}
}
}