1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-06 12:15:36 +00:00

Stop trying to save ESM4 objects in omwsave files because they currently can not be saved and only lead to errors in logs.

This commit is contained in:
Petr Mikheev 2023-10-29 22:41:53 +01:00
parent 62b787a214
commit e51dfca488

View file

@ -161,31 +161,32 @@ namespace
template <typename T>
void writeReferenceCollection(ESM::ESMWriter& writer, const MWWorld::CellRefList<T>& collection)
{
if (!collection.mList.empty())
// references
for (const MWWorld::LiveCellRef<T>& liveCellRef : collection.mList)
{
// references
for (typename MWWorld::CellRefList<T>::List::const_iterator iter(collection.mList.begin());
iter != collection.mList.end(); ++iter)
if (ESM::isESM4Rec(T::sRecordId))
{
if (!iter->mData.hasChanged() && !iter->mRef.hasChanged() && iter->mRef.hasContentFile())
{
// Reference that came from a content file and has not been changed -> ignore
continue;
}
if (iter->mData.getCount() == 0 && !iter->mRef.hasContentFile())
{
// Deleted reference that did not come from a content file -> ignore
continue;
}
using StateType = typename RecordToState<T>::StateType;
StateType state;
iter->save(state);
// recordId currently unused
writer.writeHNT("OBJE", collection.mList.front().mBase->sRecordId);
state.save(writer);
// TODO: Implement loading/saving of REFR4 and ACHR4 with ESM3 reader/writer.
continue;
}
if (!liveCellRef.mData.hasChanged() && !liveCellRef.mRef.hasChanged() && liveCellRef.mRef.hasContentFile())
{
// Reference that came from a content file and has not been changed -> ignore
continue;
}
if (liveCellRef.mData.getCount() == 0 && !liveCellRef.mRef.hasContentFile())
{
// Deleted reference that did not come from a content file -> ignore
continue;
}
using StateType = typename RecordToState<T>::StateType;
StateType state;
liveCellRef.save(state);
// recordId currently unused
writer.writeHNT("OBJE", collection.mList.front().mBase->sRecordId);
state.save(writer);
}
}