1
0
Fork 1
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:
Stanislav Bas 2015-07-12 15:20:22 +03:00 committed by cc9cii
parent 2448aa05cb
commit 377d606fc3
2 changed files with 8 additions and 16 deletions

View file

@ -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_)

View file

@ -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)
{