mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 07:53:51 +00:00
3649cf553f
This should clarify the real meaning of the packet and its associated event. The event itself has been renamed from OnPlayerKillCount to OnWorldKillCount.
33 lines
852 B
C++
33 lines
852 B
C++
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
#include "PacketWorldKillCount.hpp"
|
|
|
|
mwmp::PacketWorldKillCount::PacketWorldKillCount(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
|
{
|
|
packetID = ID_WORLD_KILL_COUNT;
|
|
}
|
|
|
|
void mwmp::PacketWorldKillCount::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, true);
|
|
RW(kill.number, send);
|
|
|
|
if (!send)
|
|
player->killChanges.kills.push_back(kill);
|
|
}
|
|
}
|