mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 04:45:33 +00:00
Load/read methods in MWWorld::Store return a pair (record ID, deleted flag)
(cherry picked from commit c266315a35
)
Conflicts:
apps/openmw/mwworld/store.cpp
apps/openmw/mwworld/store.hpp
This commit is contained in:
parent
2448aa05cb
commit
377d606fc3
2 changed files with 8 additions and 16 deletions
|
@ -95,22 +95,21 @@ void ESMStore::load(ESM::ESMReader &esm, Loading::Listener* listener)
|
|||
throw std::runtime_error(error.str());
|
||||
}
|
||||
} else {
|
||||
it->second->load(esm);
|
||||
std::string id = it->second->getLastAddedRecordId();
|
||||
if (it->second->isLastAddedRecordDeleted())
|
||||
RecordId id = it->second->load(esm);
|
||||
if (id.mIsDeleted)
|
||||
{
|
||||
it->second->eraseStatic(id);
|
||||
it->second->eraseStatic(id.mId);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (n.val==ESM::REC_DIAL) {
|
||||
dialogue = const_cast<ESM::Dialogue*>(mDialogs.find(id));
|
||||
dialogue = const_cast<ESM::Dialogue*>(mDialogs.find(id.mId));
|
||||
} else {
|
||||
dialogue = 0;
|
||||
}
|
||||
// Insert the reference into the global lookup
|
||||
if (!id.empty() && isCacheableRecord(n.val)) {
|
||||
mIds[Misc::StringUtils::lowerCase (id)] = n.val;
|
||||
if (!id.mId.empty() && isCacheableRecord(n.val)) {
|
||||
mIds[Misc::StringUtils::lowerCase (id.mId)] = n.val;
|
||||
}
|
||||
}
|
||||
listener->setProgress(static_cast<size_t>(esm.getFileOffset() / (float)esm.getFileSize() * 1000));
|
||||
|
@ -183,13 +182,12 @@ void ESMStore::setUp()
|
|||
case ESM::REC_LEVC:
|
||||
|
||||
{
|
||||
StoreBase *store = mStores[type];
|
||||
store->read (reader);
|
||||
RecordId id = mStores[type]->read (reader);
|
||||
|
||||
// FIXME: there might be stale dynamic IDs in mIds from an earlier savegame
|
||||
// that really should be cleared instead of just overwritten
|
||||
|
||||
mIds[store->getLastAddedRecordId()] = type;
|
||||
mIds[id.mId] = type;
|
||||
}
|
||||
|
||||
if (type==ESM::REC_NPC_)
|
||||
|
|
|
@ -58,12 +58,6 @@ struct Vector3
|
|||
bool readDeleSubRecord(ESMReader &esm);
|
||||
void writeDeleSubRecord(ESMWriter &esm);
|
||||
|
||||
template <class RecordT>
|
||||
std::string getRecordId(const RecordT &record)
|
||||
{
|
||||
return record.mId;
|
||||
}
|
||||
|
||||
template <class RecordT>
|
||||
bool isRecordDeleted(const RecordT &record)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue