mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-15 20:36:44 +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;
|
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()
|
Journal::Journal()
|
||||||
{}
|
{}
|
||||||
|
@ -207,6 +223,7 @@ namespace MWDialogue
|
||||||
ESM::JournalEntry record;
|
ESM::JournalEntry record;
|
||||||
record.load (reader);
|
record.load (reader);
|
||||||
|
|
||||||
|
if (isThere (record.mTopic, record.mInfo))
|
||||||
switch (record.mType)
|
switch (record.mType)
|
||||||
{
|
{
|
||||||
case ESM::JournalEntry::Type_Quest:
|
case ESM::JournalEntry::Type_Quest:
|
||||||
|
@ -230,6 +247,7 @@ namespace MWDialogue
|
||||||
ESM::QuestState record;
|
ESM::QuestState record;
|
||||||
record.load (reader);
|
record.load (reader);
|
||||||
|
|
||||||
|
if (isThere (record.mTopic))
|
||||||
mQuests.insert (std::make_pair (record.mTopic, record));
|
mQuests.insert (std::make_pair (record.mTopic, record));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ namespace MWDialogue
|
||||||
|
|
||||||
Topic& getTopic (const std::string& id);
|
Topic& getTopic (const std::string& id);
|
||||||
|
|
||||||
|
bool isThere (const std::string& topicId, const std::string& infoId = "") const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Journal();
|
Journal();
|
||||||
|
|
Loading…
Reference in a new issue