2017-05-24 16:01:28 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include "PacketPlayerTopic.hpp"
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
|
|
|
PacketPlayerTopic::PacketPlayerTopic(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
|
|
|
{
|
|
|
|
packetID = ID_PLAYER_TOPIC;
|
|
|
|
}
|
|
|
|
|
2019-12-04 08:17:33 +00:00
|
|
|
void PacketPlayerTopic::Packet(RakNet::BitStream *newBitstream, bool send)
|
2017-05-24 16:01:28 +00:00
|
|
|
{
|
2019-12-04 08:17:33 +00:00
|
|
|
PlayerPacket::Packet(newBitstream, send);
|
2017-05-24 18:43:34 +00:00
|
|
|
|
2019-10-22 22:24:13 +00:00
|
|
|
uint32_t count;
|
|
|
|
|
2017-05-24 18:43:34 +00:00
|
|
|
if (send)
|
2019-10-22 22:24:13 +00:00
|
|
|
count = static_cast<uint32_t>(player->topicChanges.size());
|
2017-05-24 18:43:34 +00:00
|
|
|
|
2019-10-22 22:24:13 +00:00
|
|
|
RW(count, send);
|
2017-05-24 18:43:34 +00:00
|
|
|
|
2019-10-22 22:24:13 +00:00
|
|
|
if (!send)
|
2017-05-24 18:43:34 +00:00
|
|
|
{
|
2019-10-22 22:24:13 +00:00
|
|
|
player->topicChanges.clear();
|
|
|
|
player->topicChanges.resize(count);
|
|
|
|
}
|
2017-05-24 18:43:34 +00:00
|
|
|
|
2019-10-22 22:24:13 +00:00
|
|
|
for (auto &&topic : player->topicChanges)
|
|
|
|
{
|
2018-07-02 18:50:21 +00:00
|
|
|
RW(topic.topicId, send, true);
|
2017-05-24 18:43:34 +00:00
|
|
|
}
|
2017-05-24 16:01:28 +00:00
|
|
|
}
|