2017-04-05 01:06:45 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
2017-04-08 05:59:21 +00:00
|
|
|
#include <components/openmw-mp/Log.hpp>
|
2017-04-10 05:37:18 +00:00
|
|
|
#include "PacketActorTest.hpp"
|
2017-04-05 01:06:45 +00:00
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
2017-04-10 05:37:18 +00:00
|
|
|
PacketActorTest::PacketActorTest(RakNet::RakPeerInterface *peer) : ActorPacket(peer)
|
2017-04-05 01:06:45 +00:00
|
|
|
{
|
2017-04-10 05:37:18 +00:00
|
|
|
packetID = ID_ACTOR_TEST;
|
2017-04-05 01:06:45 +00:00
|
|
|
}
|
|
|
|
|
2017-04-10 05:37:18 +00:00
|
|
|
void PacketActorTest::Packet(RakNet::BitStream *bs, bool send)
|
2017-04-05 01:06:45 +00:00
|
|
|
{
|
2017-04-09 05:51:28 +00:00
|
|
|
ActorPacket::Packet(bs, send);
|
2017-04-05 01:06:45 +00:00
|
|
|
|
2017-05-24 19:09:35 +00:00
|
|
|
if (send)
|
2017-04-09 13:32:44 +00:00
|
|
|
actorList->count = (unsigned int)(actorList->baseActors.size());
|
2017-05-24 19:09:35 +00:00
|
|
|
else
|
|
|
|
actorList->baseActors.clear();
|
2017-04-05 01:06:45 +00:00
|
|
|
|
2017-04-09 13:32:44 +00:00
|
|
|
RW(actorList->count, send);
|
2017-04-05 01:06:45 +00:00
|
|
|
|
2017-04-09 13:32:44 +00:00
|
|
|
BaseActor actor;
|
2017-04-05 01:06:45 +00:00
|
|
|
|
2017-04-09 13:32:44 +00:00
|
|
|
for (unsigned int i = 0; i < actorList->count; i++)
|
2017-04-05 01:06:45 +00:00
|
|
|
{
|
|
|
|
if (send)
|
|
|
|
{
|
2017-04-09 13:32:44 +00:00
|
|
|
actor = actorList->baseActors.at(i);
|
2017-04-05 01:06:45 +00:00
|
|
|
}
|
|
|
|
|
2017-04-09 13:32:44 +00:00
|
|
|
RW(actor.refNumIndex, send);
|
|
|
|
RW(actor.mpNum, send);
|
2017-04-08 05:59:21 +00:00
|
|
|
|
2017-04-05 01:06:45 +00:00
|
|
|
if (!send)
|
|
|
|
{
|
2017-04-09 13:32:44 +00:00
|
|
|
actorList->baseActors.push_back(actor);
|
2017-04-05 01:06:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|