1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 00:49:54 +00:00
openmw-tes3mp/components/openmw-mp/Packets/Object/PacketObjectSpawn.cpp
David Cernat 09da24f1ea [General] Rename all instances of refNumIndex into refNum
This creates symmetry with mpNum and should cause less confusion in the future.
2018-07-13 04:12:03 +03:00

35 lines
862 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.summonDuration, send);
RW(baseObject.isSummon, send);
if (baseObject.isSummon)
{
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);
}
}
}