mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:23:53 +00:00
Properly handle DialInfo records that were marked as Deleted (Fixes #2035)
This commit is contained in:
parent
8ba2b24a13
commit
b0f98687e6
4 changed files with 34 additions and 0 deletions
|
@ -135,6 +135,7 @@ void ESMStore::setUp()
|
|||
mSkills.setUp();
|
||||
mMagicEffects.setUp();
|
||||
mAttributes.setUp();
|
||||
mDialogs.setUp();
|
||||
}
|
||||
|
||||
int ESMStore::countSavedGameRecords() const
|
||||
|
|
|
@ -1174,6 +1174,25 @@ namespace MWWorld
|
|||
mShared.erase(mShared.begin() + mStatic.size(), mShared.end());
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void Store<ESM::Dialogue>::setUp()
|
||||
{
|
||||
// DialInfos marked as deleted are kept during the loading phase, so that the linked list
|
||||
// structure is kept intact for inserting further INFOs. Delete them now that loading is done.
|
||||
for (Static::iterator it = mStatic.begin(); it != mStatic.end(); ++it)
|
||||
{
|
||||
ESM::Dialogue& dial = it->second;
|
||||
dial.clearDeletedInfos();
|
||||
}
|
||||
|
||||
mShared.clear();
|
||||
mShared.reserve(mStatic.size());
|
||||
typename std::map<std::string, ESM::Dialogue>::iterator it = mStatic.begin();
|
||||
for (; it != mStatic.end(); ++it) {
|
||||
mShared.push_back(&(it->second));
|
||||
}
|
||||
}
|
||||
|
||||
} //end namespace
|
||||
|
||||
#endif
|
||||
|
|
|
@ -110,4 +110,15 @@ void Dialogue::readInfo(ESMReader &esm, bool merge)
|
|||
std::cerr << "Failed to insert info " << id << std::endl;
|
||||
}
|
||||
|
||||
void Dialogue::clearDeletedInfos()
|
||||
{
|
||||
for (InfoContainer::iterator it = mInfo.begin(); it != mInfo.end(); )
|
||||
{
|
||||
if (it->mQuestStatus == DialInfo::QS_Deleted)
|
||||
it = mInfo.erase(it);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,6 +47,9 @@ struct Dialogue
|
|||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm) const;
|
||||
|
||||
/// Remove all INFOs marked as QS_Deleted from mInfos.
|
||||
void clearDeletedInfos();
|
||||
|
||||
/// Read the next info record
|
||||
/// @param merge Merge with existing list, or just push each record to the end of the list?
|
||||
void readInfo (ESM::ESMReader& esm, bool merge);
|
||||
|
|
Loading…
Reference in a new issue