mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-24 10:53:51 +00:00
36 lines
848 B
C++
36 lines
848 B
C++
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
#include "PacketPlayerQuickKeys.hpp"
|
|
|
|
using namespace mwmp;
|
|
|
|
PacketPlayerQuickKeys::PacketPlayerQuickKeys(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
|
{
|
|
packetID = ID_PLAYER_QUICKKEYS;
|
|
}
|
|
|
|
void PacketPlayerQuickKeys::Packet(RakNet::BitStream *newBitstream, bool send)
|
|
{
|
|
PlayerPacket::Packet(newBitstream, send);
|
|
|
|
uint32_t count;
|
|
|
|
if (send)
|
|
count = static_cast<uint32_t>(player->quickKeyChanges.size());
|
|
|
|
RW(count, send);
|
|
|
|
if (!send)
|
|
{
|
|
player->quickKeyChanges.clear();
|
|
player->quickKeyChanges.resize(count);
|
|
}
|
|
|
|
for (auto &&quickKey : player->quickKeyChanges)
|
|
{
|
|
RW(quickKey.type, send);
|
|
RW(quickKey.slot, send);
|
|
|
|
if (quickKey.type != QuickKey::UNASSIGNED)
|
|
RW(quickKey.itemId, send);
|
|
}
|
|
}
|