mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Properly handle DialInfo records that were marked as Deleted (Fixes #2035)
This commit is contained in:
parent
154cac506c
commit
4047e3c928
4 changed files with 34 additions and 0 deletions
|
@ -135,6 +135,7 @@ void ESMStore::setUp()
|
||||||
mSkills.setUp();
|
mSkills.setUp();
|
||||||
mMagicEffects.setUp();
|
mMagicEffects.setUp();
|
||||||
mAttributes.setUp();
|
mAttributes.setUp();
|
||||||
|
mDialogs.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ESMStore::countSavedGameRecords() const
|
int ESMStore::countSavedGameRecords() const
|
||||||
|
|
|
@ -1174,6 +1174,25 @@ namespace MWWorld
|
||||||
mShared.erase(mShared.begin() + mStatic.size(), mShared.end());
|
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
|
} //end namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -110,4 +110,15 @@ void Dialogue::readInfo(ESMReader &esm, bool merge)
|
||||||
std::cerr << "Failed to insert info " << id << std::endl;
|
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 load(ESMReader &esm);
|
||||||
void save(ESMWriter &esm) const;
|
void save(ESMWriter &esm) const;
|
||||||
|
|
||||||
|
/// Remove all INFOs marked as QS_Deleted from mInfos.
|
||||||
|
void clearDeletedInfos();
|
||||||
|
|
||||||
/// Read the next info record
|
/// Read the next info record
|
||||||
/// @param merge Merge with existing list, or just push each record to the end of the list?
|
/// @param merge Merge with existing list, or just push each record to the end of the list?
|
||||||
void readInfo (ESM::ESMReader& esm, bool merge);
|
void readInfo (ESM::ESMReader& esm, bool merge);
|
||||||
|
|
Loading…
Reference in a new issue