Fix mIds mapping for dynamic records being lost on save/reload

openmw-35
scrawl 10 years ago
parent 928b9ee41b
commit d31ae2b345

@ -192,7 +192,15 @@ void ESMStore::setUp()
case ESM::REC_LEVI:
case ESM::REC_LEVC:
mStores[type]->read (reader);
{
std::string id = reader.getHNString ("NAME");
mStores[type]->read (reader, id);
// FIXME: there might be stale dynamic IDs in mIds from an earlier savegame
// that really should be cleared instead of just overwritten
mIds[id] = type;
}
if (type==ESM::REC_NPC_)
{

@ -30,7 +30,7 @@ namespace MWWorld
virtual void write (ESM::ESMWriter& writer) const {}
virtual void read (ESM::ESMReader& reader) {}
virtual void read (ESM::ESMReader& reader, const std::string& id) {}
///< Read into dynamic storage
};
@ -329,10 +329,10 @@ namespace MWWorld
}
}
void read (ESM::ESMReader& reader)
void read (ESM::ESMReader& reader, const std::string& id)
{
T record;
record.mId = reader.getHNString ("NAME");
record.mId = id;
record.load (reader);
insert (record);
}

Loading…
Cancel
Save