mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 00:53:51 +00:00
31 lines
736 B
C++
31 lines
736 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);
|
|
}
|
|
}
|