Skip to content

Commit

Permalink
Stop trying to save ESM4 objects in omwsave files because they curren…
Browse files Browse the repository at this point in the history
…tly can not be saved and only lead to errors in logs.
  • Loading branch information
petrmikheev committed Oct 29, 2023
1 parent 62b787a commit e51dfca
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions apps/openmw/mwworld/cellstore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// 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);
// recordId currently unused
writer.writeHNT("OBJE", collection.mList.front().mBase->sRecordId);

state.save(writer);
}
state.save(writer);
}
}

Expand Down

0 comments on commit e51dfca

Please sign in to comment.