2019-10-08 08:09:08 +00:00
|
|
|
#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;
|
|
|
|
}
|
|
|
|
|
2019-12-04 08:17:33 +00:00
|
|
|
void PacketWorldKillCount::Packet(RakNet::BitStream *newBitstream, bool send)
|
2019-10-08 08:09:08 +00:00
|
|
|
{
|
2019-12-04 08:17:33 +00:00
|
|
|
WorldstatePacket::Packet(newBitstream, send);
|
2019-10-08 08:09:08 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|