1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 09:49:55 +00:00
openmw-tes3mp/components/openmw-mp/Packets/Player/PacketPlayerKillCount.cpp

34 lines
854 B
C++
Raw Normal View History

#include <components/openmw-mp/NetworkMessages.hpp>
#include "PacketPlayerKillCount.hpp"
mwmp::PacketPlayerKillCount::PacketPlayerKillCount(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
{
packetID = ID_PLAYER_KILL_COUNT;
}
void mwmp::PacketPlayerKillCount::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, send);
if (send)
player->killChanges.count = (unsigned int)(player->killChanges.kills.size());
else
player->killChanges.kills.clear();
RW(player->killChanges.count, send);
for (unsigned int i = 0; i < player->killChanges.count; i++)
{
Kill kill;
if (send)
kill = player->killChanges.kills.at(i);
RW(kill.refId, send, 1);
RW(kill.number, send);
if (!send)
player->killChanges.kills.push_back(kill);
}
}