openmw-tes3coop/components/openmw-mp/Packets/Player/PacketPlayerTopic.cpp
Koncord 23684489da [General] Fix clang-tidy warning
Converting integer literal to bool, use bool literal instead
2018-07-03 02:50:21 +08:00

35 lines
855 B
C++

#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);
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);
RW(topic.topicId, send, true);
if (!send)
player->topicChanges.topics.push_back(topic);
}
}