openmw-tes3coop/components/openmw-mp/Packets/Actor/PacketActorAnimPlay.cpp
2017-05-28 15:23:16 +08:00

45 lines
1.1 KiB
C++

#include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Log.hpp>
#include "PacketActorAnimPlay.hpp"
using namespace mwmp;
PacketActorAnimPlay::PacketActorAnimPlay(RakNet::RakPeerInterface *peer) : ActorPacket(peer)
{
packetID = ID_ACTOR_ANIM_PLAY;
}
void PacketActorAnimPlay::Packet(RakNet::BitStream *bs, bool send)
{
ActorPacket::Packet(bs, send);
if (send)
actorList->count = (unsigned int)(actorList->baseActors.size());
else
actorList->baseActors.clear();
RW(actorList->count, send);
BaseActor actor;
for (unsigned int i = 0; i < actorList->count; i++)
{
if (send)
{
actor = actorList->baseActors.at(i);
}
RW(actor.refNumIndex, send);
RW(actor.mpNum, send);
RW(actor.animation.groupname, send);
RW(actor.animation.mode, send);
RW(actor.animation.count, send);
RW(actor.animation.persist, send);
if (!send)
{
actorList->baseActors.push_back(actor);
}
}
}