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