Skip to content

An OpenMW mod that lets you play the whole Elder Scrolls III: Morrowind as a top-down isometric game — with full online co-op or MMO modes.

C++
855 B
Raw Blame
#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 *newBitstream, bool send)
{
    WorldstatePacket::Packet(newBitstream, 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);
    }
}