[Client] Only add valid quests to journal

pull/281/head
David Cernat 7 years ago
parent 134dd06d48
commit cf4021a7b5

@ -666,18 +666,28 @@ void LocalPlayer::addJournalItems()
{ {
for (const auto &journalItem : journalChanges.journalItems) for (const auto &journalItem : journalChanges.journalItems)
{ {
MWWorld::Ptr ptrFound;
if (journalItem.type == JournalItem::ENTRY) if (journalItem.type == JournalItem::ENTRY)
{ {
MWWorld::Ptr ptrFound = MWBase::Environment::get().getWorld()->searchPtr(journalItem.actorRefId, false); ptrFound = MWBase::Environment::get().getWorld()->searchPtr(journalItem.actorRefId, false);
if (!ptrFound) if (!ptrFound)
ptrFound = getPlayerPtr(); ptrFound = getPlayerPtr();
}
try
{
if (journalItem.type == JournalItem::ENTRY)
MWBase::Environment::get().getJournal()->addEntry(journalItem.quest, journalItem.index, ptrFound); MWBase::Environment::get().getJournal()->addEntry(journalItem.quest, journalItem.index, ptrFound);
}
else else
MWBase::Environment::get().getJournal()->setJournalIndex(journalItem.quest, journalItem.index); MWBase::Environment::get().getJournal()->setJournalIndex(journalItem.quest, journalItem.index);
} }
catch (std::exception&)
{
LOG_APPEND(Log::LOG_INFO, "- Ignored addition of invalid journal quest %s", journalItem.quest.c_str());
}
}
} }
void LocalPlayer::addTopics() void LocalPlayer::addTopics()

@ -15,6 +15,8 @@ namespace mwmp
virtual void Do(PlayerPacket &packet, BasePlayer *player) virtual void Do(PlayerPacket &packet, BasePlayer *player)
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_JOURNAL from server");
if (isRequest()) if (isRequest())
{ {
// Entire journal cannot currently be requested from players // Entire journal cannot currently be requested from players

Loading…
Cancel
Save