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 std;
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2017-03-06 09:44:08 +00:00
|
|
|
void PacketPlayerJournal::Packet(RakNet::BitStream *bs, bool send)
|
2017-01-20 09:15:10 +00:00
|
|
|
{
|
2017-03-06 09:44:08 +00:00
|
|
|
PlayerPacket::Packet(bs, send);
|
2017-01-24 17:32:25 +00:00
|
|
|
|
2017-11-28 13:37:46 +00:00
|
|
|
uint32_t count;
|
|
|
|
|
2017-05-24 19:09:35 +00:00
|
|
|
if (send)
|
2017-11-28 13:37:46 +00:00
|
|
|
count = static_cast<uint32_t>(player->journalChanges.journalItems.size());
|
2017-01-24 17:32:25 +00:00
|
|
|
|
2017-11-28 13:37:46 +00:00
|
|
|
RW(count, send);
|
2017-01-24 17:32:25 +00:00
|
|
|
|
2017-11-29 11:00:22 +00:00
|
|
|
if (!send)
|
2017-01-24 17:32:25 +00:00
|
|
|
{
|
2017-11-28 13:37:46 +00:00
|
|
|
player->journalChanges.journalItems.clear();
|
|
|
|
player->journalChanges.journalItems.resize(count);
|
|
|
|
}
|
2017-01-24 17:32:25 +00:00
|
|
|
|
2017-11-28 13:37:46 +00:00
|
|
|
for (auto &&journalItem : player->journalChanges.journalItems)
|
|
|
|
{
|
2017-01-24 17:32:25 +00:00
|
|
|
RW(journalItem.type, send);
|
2017-11-28 13:37:46 +00:00
|
|
|
RW(journalItem.quest, send, true);
|
2017-01-24 17:32:25 +00:00
|
|
|
RW(journalItem.index, send);
|
|
|
|
|
|
|
|
if (journalItem.type == JournalItem::ENTRY)
|
2017-11-28 13:37:46 +00:00
|
|
|
RW(journalItem.actorRefId, send, true);
|
2017-01-24 17:32:25 +00:00
|
|
|
}
|
2017-01-20 09:15:10 +00:00
|
|
|
}
|