1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-22 00:53:50 +00:00
openmw-tes3mp/components/openmw-mp/Packets/Player/PacketPlayerKillCount.cpp

32 lines
735 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);
2017-11-28 13:37:46 +00:00
uint32_t count;
if (send)
2017-11-28 13:37:46 +00:00
count = static_cast<uint32_t>(player->killChanges.kills.size());
2017-11-28 13:37:46 +00:00
RW(count, send);
2017-11-28 13:37:46 +00:00
if(!send)
{
2017-11-28 13:37:46 +00:00
player->killChanges.kills.clear();
player->killChanges.kills.resize(count);
}
2017-11-28 13:37:46 +00:00
for (auto &&kill : player->killChanges.kills)
{
RW(kill.refId, send, true);
RW(kill.number, send);
}
}