mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-15 23:49:55 +00:00
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
#include "PacketObjectActivate.hpp"
|
|
|
|
using namespace mwmp;
|
|
|
|
PacketObjectActivate::PacketObjectActivate(RakNet::RakPeerInterface *peer) : ObjectPacket(peer)
|
|
{
|
|
packetID = ID_OBJECT_ACTIVATE;
|
|
hasCellData = true;
|
|
}
|
|
|
|
void PacketObjectActivate::Packet(RakNet::BitStream *bs, bool send)
|
|
{
|
|
if (!PacketHeader(bs, send))
|
|
return;
|
|
|
|
BaseObject baseObject;
|
|
for (unsigned int i = 0; i < objectList->baseObjectCount; i++)
|
|
{
|
|
if (send)
|
|
baseObject = objectList->baseObjects.at(i);
|
|
|
|
RW(baseObject.isPlayer, send);
|
|
|
|
if (baseObject.isPlayer)
|
|
RW(baseObject.guid, send);
|
|
else
|
|
Object(baseObject, send);
|
|
|
|
RW(baseObject.activatingActor.isPlayer, send);
|
|
|
|
if (baseObject.activatingActor.isPlayer)
|
|
{
|
|
RW(baseObject.activatingActor.guid, send);
|
|
}
|
|
else
|
|
{
|
|
RW(baseObject.activatingActor.refId, send, true);
|
|
RW(baseObject.activatingActor.refNum, send);
|
|
RW(baseObject.activatingActor.mpNum, send);
|
|
|
|
RW(baseObject.activatingActor.name, send);
|
|
}
|
|
|
|
if (!send)
|
|
objectList->baseObjects.push_back(baseObject);
|
|
}
|
|
}
|