2017-05-24 16:01:28 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include "PacketPlayerTopic.hpp"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace mwmp;
|
|
|
|
|
|
|
|
PacketPlayerTopic::PacketPlayerTopic(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
|
|
|
{
|
|
|
|
packetID = ID_PLAYER_TOPIC;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PacketPlayerTopic::Packet(RakNet::BitStream *bs, bool send)
|
|
|
|
{
|
|
|
|
PlayerPacket::Packet(bs, send);
|
2017-05-24 18:43:34 +00:00
|
|
|
|
|
|
|
if (send)
|
|
|
|
player->topicChanges.count = (unsigned int)(player->topicChanges.topics.size());
|
|
|
|
else
|
|
|
|
player->topicChanges.topics.clear();
|
|
|
|
|
|
|
|
RW(player->topicChanges.count, send);
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < player->topicChanges.count; i++)
|
|
|
|
{
|
|
|
|
Topic topic;
|
|
|
|
|
|
|
|
if (send)
|
|
|
|
topic = player->topicChanges.topics.at(i);
|
|
|
|
|
2018-07-02 18:50:21 +00:00
|
|
|
RW(topic.topicId, send, true);
|
2017-05-24 18:43:34 +00:00
|
|
|
|
|
|
|
if (!send)
|
|
|
|
player->topicChanges.topics.push_back(topic);
|
|
|
|
}
|
2017-05-24 16:01:28 +00:00
|
|
|
}
|