1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-03 04:15:32 +00:00

handle deleted records

This commit is contained in:
Marc Zinnschlag 2013-02-07 13:26:00 +01:00
parent c1cd8305bc
commit dd2b7d5c63

View file

@ -321,14 +321,35 @@ namespace CSMWorld
{
std::string id = reader.getHNOString ("NAME");
/// \todo deal with deleted flag
int index = searchId (id);
if (reader.isNextSub ("DELE"))
{
reader.skipRecord();
if (index==-1)
{
// deleting a record that does not exist
// ignore it for now
/// \todo report the problem to the user
}
else if (base)
{
removeRows (index, 1);
}
else
{
mRecords[index].mState = RecordBase::State_Deleted;
}
}
else
{
ESXRecordT record;
record.mId = id;
record.load (reader);
int index = searchId (id);
if (index==-1)
{
// new record
@ -349,6 +370,7 @@ namespace CSMWorld
record2.setModified (record);
}
}
}
template<typename ESXRecordT>
const RecordBase& IdCollection<ESXRecordT>::getRecord (const std::string& id) const