diff --git a/apps/openmw/mwworld/cellreflist.hpp b/apps/openmw/mwworld/cellreflist.hpp index 51e1d7df05..e996ba163c 100644 --- a/apps/openmw/mwworld/cellreflist.hpp +++ b/apps/openmw/mwworld/cellreflist.hpp @@ -28,7 +28,7 @@ namespace MWWorld /// all methods are known. void load(ESM::CellRef& ref, bool deleted, const MWWorld::ESMStore& esmStore); - void load(const ESM4::Reference& ref, bool deleted, const MWWorld::ESMStore& esmStore); + void load(const ESM4::Reference& ref, const MWWorld::ESMStore& esmStore); LiveRef& insert(const LiveRef& item) { diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index c6a03244be..cc20ce0a5d 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -376,7 +376,7 @@ namespace MWWorld } template - void CellRefList::load(const ESM4::Reference& ref, bool deleted, const MWWorld::ESMStore& esmStore) + void CellRefList::load(const ESM4::Reference& ref, const MWWorld::ESMStore& esmStore) { if constexpr (!ESM::isESM4Rec(X::sRecordId)) @@ -387,8 +387,6 @@ namespace MWWorld if (const X* ptr = store.search(ref.mBaseObj)) { LiveRef liveCellRef(ref, ptr); - if (deleted) - liveCellRef.mData.setDeletedByContentFile(true); mList.push_back(liveCellRef); } else @@ -828,7 +826,7 @@ namespace MWWorld void CellStore::loadRefs(const ESM4::Cell& cell, std::map& refNumToID) { - visitCell4References(cell, mStore, mReaders, [&](const ESM4::Reference& ref) { loadRef(ref, false); }); + visitCell4References(cell, mStore, mReaders, [&](const ESM4::Reference& ref) { loadRef(ref); }); } void CellStore::loadRefs() @@ -870,15 +868,14 @@ namespace MWWorld return Ptr(); } - void CellStore::loadRef(const ESM4::Reference& ref, bool deleted) + void CellStore::loadRef(const ESM4::Reference& ref) { const MWWorld::ESMStore& store = mStore; ESM::RecNameInts foundType = static_cast(store.find(ref.mBaseObj)); - Misc::tupleForEach(this->mCellStoreImp->mRefLists, [&ref, &deleted, &store, foundType](auto& x) { - recNameSwitcher( - x, foundType, [&ref, &deleted, &store](auto& storeIn) { storeIn.load(ref, deleted, store); }); + Misc::tupleForEach(this->mCellStoreImp->mRefLists, [&ref, &store, foundType](auto& x) { + recNameSwitcher(x, foundType, [&ref, &store](auto& storeIn) { storeIn.load(ref, store); }); }); } diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index 1bcf1b30ff..3ffa55a0a9 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -419,7 +419,7 @@ namespace MWWorld void loadRefs(); - void loadRef(const ESM4::Reference& ref, bool deleted); + void loadRef(const ESM4::Reference& ref); void loadRef(ESM::CellRef& ref, bool deleted, std::map& refNumToID); ///< Make case-adjustments to \a ref and insert it into the respective container. /// diff --git a/apps/openmw/mwworld/refdata.cpp b/apps/openmw/mwworld/refdata.cpp index e0d0f63cf6..dc7c336809 100644 --- a/apps/openmw/mwworld/refdata.cpp +++ b/apps/openmw/mwworld/refdata.cpp @@ -85,13 +85,13 @@ namespace MWWorld { } - RefData::RefData(const ESM4::Reference& cellRef) + RefData::RefData(const ESM4::Reference& ref) : mBaseNode(nullptr) - , mDeletedByContentFile(false) - , mEnabled(true) + , mDeletedByContentFile(ref.mFlags & ESM4::Rec_Deleted) + , mEnabled(!(ref.mFlags & ESM4::Rec_Disabled)) , mPhysicsPostponed(false) - , mCount(1) - , mPosition(cellRef.mPos) + , mCount(ref.mCount) + , mPosition(ref.mPos) , mCustomData(nullptr) , mChanged(false) , mFlags(0)