openmw-tes3coop/components/openmw-mp/Packets/Player/PacketPlayerJournal.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

42 lines
1.1 KiB
C++

#include <components/openmw-mp/NetworkMessages.hpp>
#include "PacketPlayerJournal.hpp"
using namespace std;
using namespace mwmp;
PacketPlayerJournal::PacketPlayerJournal(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
{
packetID = ID_PLAYER_JOURNAL;
}
void PacketPlayerJournal::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, send);
if (send)
player->journalChanges.count = (unsigned int)(player->journalChanges.journalItems.size());
else
player->journalChanges.journalItems.clear();
RW(player->journalChanges.count, send);
for (unsigned int i = 0; i < player->journalChanges.count; i++)
{
JournalItem journalItem;
if (send)
journalItem = player->journalChanges.journalItems.at(i);
RW(journalItem.type, send);
RW(journalItem.quest, send, true);
RW(journalItem.index, send);
if (journalItem.type == JournalItem::ENTRY)
{
RW(journalItem.actorRefId, send, true);
}
if (!send)
player->journalChanges.journalItems.push_back(journalItem);
}
}