mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:23:54 +00:00
handle deleted records
This commit is contained in:
parent
c1cd8305bc
commit
dd2b7d5c63
1 changed files with 39 additions and 17 deletions
|
@ -321,14 +321,35 @@ namespace CSMWorld
|
||||||
{
|
{
|
||||||
std::string id = reader.getHNOString ("NAME");
|
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;
|
ESXRecordT record;
|
||||||
record.mId = id;
|
record.mId = id;
|
||||||
record.load (reader);
|
record.load (reader);
|
||||||
|
|
||||||
int index = searchId (id);
|
|
||||||
|
|
||||||
if (index==-1)
|
if (index==-1)
|
||||||
{
|
{
|
||||||
// new record
|
// new record
|
||||||
|
@ -349,6 +370,7 @@ namespace CSMWorld
|
||||||
record2.setModified (record);
|
record2.setModified (record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<typename ESXRecordT>
|
template<typename ESXRecordT>
|
||||||
const RecordBase& IdCollection<ESXRecordT>::getRecord (const std::string& id) const
|
const RecordBase& IdCollection<ESXRecordT>::getRecord (const std::string& id) const
|
||||||
|
|
Loading…
Reference in a new issue