forked from mirror/openmw-tes3mp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.2 KiB
C++
49 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);
|
|
}
|
|
}
|