1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 20:19:56 +00:00
openmw-tes3mp/components/openmw-mp/Packets/Player/PacketPlayerTopic.cpp

32 lines
695 B
C++

#include <components/openmw-mp/NetworkMessages.hpp>
#include "PacketPlayerTopic.hpp"
using namespace mwmp;
PacketPlayerTopic::PacketPlayerTopic(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
{
packetID = ID_PLAYER_TOPIC;
}
void PacketPlayerTopic::Packet(RakNet::BitStream *newBitstream, bool send)
{
PlayerPacket::Packet(newBitstream, send);
uint32_t count;
if (send)
count = static_cast<uint32_t>(player->topicChanges.size());
RW(count, send);
if (!send)
{
player->topicChanges.clear();
player->topicChanges.resize(count);
}
for (auto &&topic : player->topicChanges)
{
RW(topic.topicId, send, true);
}
}