1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:23:52 +00:00

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

This commit is contained in:
scrawl 2015-01-08 16:17:13 +01:00
parent 928b9ee41b
commit d31ae2b345
2 changed files with 12 additions and 4 deletions

View file

@ -192,7 +192,15 @@ void ESMStore::setUp()
case ESM::REC_LEVI: case ESM::REC_LEVI:
case ESM::REC_LEVC: 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_) if (type==ESM::REC_NPC_)
{ {

View file

@ -30,7 +30,7 @@ namespace MWWorld
virtual void write (ESM::ESMWriter& writer) const {} 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 ///< 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; T record;
record.mId = reader.getHNString ("NAME"); record.mId = id;
record.load (reader); record.load (reader);
insert (record); insert (record);
} }