2017-01-20 09:15:10 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
2017-02-05 07:01:33 +00:00
|
|
|
#include "PacketPlayerJournal.hpp"
|
2017-01-20 09:15:10 +00:00
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
2017-02-05 07:01:33 +00:00
|
|
|
PacketPlayerJournal::PacketPlayerJournal(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
2017-01-20 09:15:10 +00:00
|
|
|
{
|
2017-02-05 07:01:33 +00:00
|
|
|
packetID = ID_PLAYER_JOURNAL;
|
2017-01-20 09:15:10 +00:00
|
|
|
}
|
|
|
|
|
2019-12-04 08:17:33 +00:00
|
|
|
void PacketPlayerJournal::Packet(RakNet::BitStream *newBitstream, bool send)
|
2017-01-20 09:15:10 +00:00
|
|
|
{
|
2019-12-04 08:17:33 +00:00
|
|
|
PlayerPacket::Packet(newBitstream, send);
|
2017-01-24 17:32:25 +00:00
|
|
|
|
2019-10-21 04:01:36 +00:00
|
|
|
uint32_t count;
|
|
|
|
|
2017-05-24 19:09:35 +00:00
|
|
|
if (send)
|
2019-10-21 04:01:36 +00:00
|
|
|
count = static_cast<uint32_t>(player->journalChanges.size());
|
2017-01-24 17:32:25 +00:00
|
|
|
|
2019-10-21 04:01:36 +00:00
|
|
|
RW(count, send);
|
2017-01-24 17:32:25 +00:00
|
|
|
|
2019-10-21 04:01:36 +00:00
|
|
|
if (!send)
|
2017-01-24 17:32:25 +00:00
|
|
|
{
|
2019-10-21 04:01:36 +00:00
|
|
|
player->journalChanges.clear();
|
|
|
|
player->journalChanges.resize(count);
|
|
|
|
}
|
2017-01-24 17:32:25 +00:00
|
|
|
|
2019-10-21 04:01:36 +00:00
|
|
|
for (auto &&journalItem : player->journalChanges)
|
|
|
|
{
|
2017-01-24 17:32:25 +00:00
|
|
|
RW(journalItem.type, send);
|
2018-07-02 18:50:21 +00:00
|
|
|
RW(journalItem.quest, send, true);
|
2017-01-24 17:32:25 +00:00
|
|
|
RW(journalItem.index, send);
|
|
|
|
|
|
|
|
if (journalItem.type == JournalItem::ENTRY)
|
|
|
|
{
|
2018-07-02 18:50:21 +00:00
|
|
|
RW(journalItem.actorRefId, send, true);
|
2018-07-26 01:36:12 +00:00
|
|
|
|
|
|
|
RW(journalItem.hasTimestamp, send);
|
|
|
|
|
|
|
|
if (journalItem.hasTimestamp)
|
|
|
|
{
|
|
|
|
RW(journalItem.timestamp.daysPassed, send);
|
|
|
|
RW(journalItem.timestamp.month, send);
|
|
|
|
RW(journalItem.timestamp.day, send);
|
|
|
|
}
|
2017-01-24 17:32:25 +00:00
|
|
|
}
|
|
|
|
}
|
2017-01-20 09:15:10 +00:00
|
|
|
}
|