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 bef53749ed [General] Replace BaseObject's hasMaster variable with isSummon
Additionally, add a GetObjectSummonState() script function to the server.
2018-07-02 02:25:06 +03:00

35 lines
864 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, 1);
RW(baseObject.master.refNumIndex, send);
RW(baseObject.master.mpNum, send);
}
}
}