mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-31 22:15:33 +00:00
deal with dialogue/info records that don't exist anymore
This commit is contained in:
parent
e269c9e689
commit
34cdd2bb1f
2 changed files with 33 additions and 13 deletions
|
@ -48,6 +48,22 @@ namespace MWDialogue
|
|||
return iter->second;
|
||||
}
|
||||
|
||||
bool Journal::isThere (const std::string& topicId, const std::string& infoId) const
|
||||
{
|
||||
if (const ESM::Dialogue *dialogue =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().search (topicId))
|
||||
{
|
||||
if (infoId.empty())
|
||||
return true;
|
||||
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
|
||||
iter!=dialogue->mInfo.end(); ++iter)
|
||||
if (iter->mId == infoId)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Journal::Journal()
|
||||
{}
|
||||
|
@ -207,30 +223,32 @@ namespace MWDialogue
|
|||
ESM::JournalEntry record;
|
||||
record.load (reader);
|
||||
|
||||
switch (record.mType)
|
||||
{
|
||||
case ESM::JournalEntry::Type_Quest:
|
||||
if (isThere (record.mTopic, record.mInfo))
|
||||
switch (record.mType)
|
||||
{
|
||||
case ESM::JournalEntry::Type_Quest:
|
||||
|
||||
getQuest (record.mTopic).insertEntry (record);
|
||||
break;
|
||||
getQuest (record.mTopic).insertEntry (record);
|
||||
break;
|
||||
|
||||
case ESM::JournalEntry::Type_Journal:
|
||||
case ESM::JournalEntry::Type_Journal:
|
||||
|
||||
mJournal.push_back (record);
|
||||
break;
|
||||
mJournal.push_back (record);
|
||||
break;
|
||||
|
||||
case ESM::JournalEntry::Type_Topic:
|
||||
case ESM::JournalEntry::Type_Topic:
|
||||
|
||||
getTopic (record.mTopic).insertEntry (record);
|
||||
break;
|
||||
}
|
||||
getTopic (record.mTopic).insertEntry (record);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (type==ESM::REC_QUES)
|
||||
{
|
||||
ESM::QuestState record;
|
||||
record.load (reader);
|
||||
|
||||
mQuests.insert (std::make_pair (record.mTopic, record));
|
||||
if (isThere (record.mTopic))
|
||||
mQuests.insert (std::make_pair (record.mTopic, record));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ namespace MWDialogue
|
|||
|
||||
Topic& getTopic (const std::string& id);
|
||||
|
||||
bool isThere (const std::string& topicId, const std::string& infoId = "") const;
|
||||
|
||||
public:
|
||||
|
||||
Journal();
|
||||
|
|
Loading…
Reference in a new issue