Remove NAME handling from MWWorld::ESMStore

openmw-38
Stanislav Bas 10 years ago
parent 89e44c8f1f
commit 9301bc148e

@ -95,23 +95,12 @@ void ESMStore::load(ESM::ESMReader &esm, Loading::Listener* listener)
throw std::runtime_error(error.str()); throw std::runtime_error(error.str());
} }
} else { } else {
// Load it it->second->load(esm);
std::string id = esm.getHNOString("NAME"); std::string id = it->second->getLastAddedRecordId();
// ... unless it got deleted! This means that the following record if (it->second->isLastAddedRecordDeleted())
// has been deleted, and trying to load it using standard assumptions {
// on the structure will (probably) fail. it->second->eraseStatic(id);
if (esm.isNextSub("DELE")) { continue;
esm.skipRecord();
it->second->eraseStatic(id);
continue;
}
it->second->load(esm, id);
// DELE can also occur after the usual subrecords
if (esm.isNextSub("DELE")) {
esm.skipRecord();
it->second->eraseStatic(id);
continue;
} }
if (n.val==ESM::REC_DIAL) { if (n.val==ESM::REC_DIAL) {
@ -194,13 +183,13 @@ void ESMStore::setUp()
case ESM::REC_LEVC: case ESM::REC_LEVC:
{ {
std::string id = reader.getHNString ("NAME"); StoreBase *store = mStores[type];
mStores[type]->read (reader, id); 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[id] = type; mIds[store->getLastAddedRecordId()] = type;
} }
if (type==ESM::REC_NPC_) if (type==ESM::REC_NPC_)

Loading…
Cancel
Save