1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-06 23:11:34 +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

@ -160,26 +160,28 @@ namespace
template <typename T> template <typename T>
void writeReferenceCollection(ESM::ESMWriter& writer, const MWWorld::CellRefList<T>& collection) void writeReferenceCollection(ESM::ESMWriter& writer, const MWWorld::CellRefList<T>& collection)
{
if (!collection.mList.empty())
{ {
// references // references
for (typename MWWorld::CellRefList<T>::List::const_iterator iter(collection.mList.begin()); for (const MWWorld::LiveCellRef<T>& liveCellRef : collection.mList)
iter != collection.mList.end(); ++iter)
{ {
if (!iter->mData.hasChanged() && !iter->mRef.hasChanged() && iter->mRef.hasContentFile()) if (ESM::isESM4Rec(T::sRecordId))
{
// 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 // Reference that came from a content file and has not been changed -> ignore
continue; continue;
} }
if (iter->mData.getCount() == 0 && !iter->mRef.hasContentFile()) if (liveCellRef.mData.getCount() == 0 && !liveCellRef.mRef.hasContentFile())
{ {
// Deleted reference that did not come from a content file -> ignore // Deleted reference that did not come from a content file -> ignore
continue; continue;
} }
using StateType = typename RecordToState<T>::StateType; using StateType = typename RecordToState<T>::StateType;
StateType state; StateType state;
iter->save(state); liveCellRef.save(state);
// recordId currently unused // recordId currently unused
writer.writeHNT("OBJE", collection.mList.front().mBase->sRecordId); writer.writeHNT("OBJE", collection.mList.front().mBase->sRecordId);
@ -187,7 +189,6 @@ namespace
state.save(writer); state.save(writer);
} }
} }
}
template <class RecordType, class T> template <class RecordType, class T>
void fixRestockingImpl(const T* base, RecordType& state) void fixRestockingImpl(const T* base, RecordType& state)