1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 13:53:51 +00:00
openmw-tes3mp/components/openmw-mp/Packets/Player/PacketPlayerKillCount.cpp
2017-11-28 21:38:45 +08:00

31 lines
735 B
C++

#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);
uint32_t count;
if (send)
count = static_cast<uint32_t>(player->killChanges.kills.size());
RW(count, send);
if(!send)
{
player->killChanges.kills.clear();
player->killChanges.kills.resize(count);
}
for (auto &&kill : player->killChanges.kills)
{
RW(kill.refId, send, true);
RW(kill.number, send);
}
}