mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 08:49:55 +00:00
35 lines
835 B
C++
35 lines
835 B
C++
|
#include "PacketWorldKillCount.hpp"
|
||
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||
|
|
||
|
using namespace mwmp;
|
||
|
|
||
|
PacketWorldKillCount::PacketWorldKillCount(RakNet::RakPeerInterface *peer) : WorldstatePacket(peer)
|
||
|
{
|
||
|
packetID = ID_WORLD_KILL_COUNT;
|
||
|
orderChannel = CHANNEL_SYSTEM;
|
||
|
}
|
||
|
|
||
|
void PacketWorldKillCount::Packet(RakNet::BitStream *bs, bool send)
|
||
|
{
|
||
|
WorldstatePacket::Packet(bs, send);
|
||
|
|
||
|
uint32_t killChangesCount;
|
||
|
|
||
|
if (send)
|
||
|
killChangesCount = static_cast<uint32_t>(worldstate->killChanges.size());
|
||
|
|
||
|
RW(killChangesCount, send);
|
||
|
|
||
|
if (!send)
|
||
|
{
|
||
|
worldstate->killChanges.clear();
|
||
|
worldstate->killChanges.resize(killChangesCount);
|
||
|
}
|
||
|
|
||
|
for (auto &&killChange : worldstate->killChanges)
|
||
|
{
|
||
|
RW(killChange.refId, send, true);
|
||
|
RW(killChange.number, send);
|
||
|
}
|
||
|
}
|