1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-09 09:39:53 +00:00

Handle ESM4::Rec_Deleted and ESM4::Rec_Disabled flags.

This commit is contained in:
Petr Mikheev 2023-07-22 15:21:04 +02:00
parent 62ef209185
commit 9105a073fc
4 changed files with 12 additions and 15 deletions

View File

@ -28,7 +28,7 @@ namespace MWWorld
/// all methods are known. /// all methods are known.
void load(ESM::CellRef& ref, bool deleted, const MWWorld::ESMStore& esmStore); 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) LiveRef& insert(const LiveRef& item)
{ {

View File

@ -376,7 +376,7 @@ namespace MWWorld
} }
template <typename X> template <typename X>
void CellRefList<X>::load(const ESM4::Reference& ref, bool deleted, const MWWorld::ESMStore& esmStore) void CellRefList<X>::load(const ESM4::Reference& ref, const MWWorld::ESMStore& esmStore)
{ {
if constexpr (!ESM::isESM4Rec(X::sRecordId)) if constexpr (!ESM::isESM4Rec(X::sRecordId))
@ -387,8 +387,6 @@ namespace MWWorld
if (const X* ptr = store.search(ref.mBaseObj)) if (const X* ptr = store.search(ref.mBaseObj))
{ {
LiveRef liveCellRef(ref, ptr); LiveRef liveCellRef(ref, ptr);
if (deleted)
liveCellRef.mData.setDeletedByContentFile(true);
mList.push_back(liveCellRef); mList.push_back(liveCellRef);
} }
else else
@ -828,7 +826,7 @@ namespace MWWorld
void CellStore::loadRefs(const ESM4::Cell& cell, std::map<ESM::RefNum, ESM::RefId>& refNumToID) void CellStore::loadRefs(const ESM4::Cell& cell, std::map<ESM::RefNum, ESM::RefId>& 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() void CellStore::loadRefs()
@ -870,15 +868,14 @@ namespace MWWorld
return Ptr(); return Ptr();
} }
void CellStore::loadRef(const ESM4::Reference& ref, bool deleted) void CellStore::loadRef(const ESM4::Reference& ref)
{ {
const MWWorld::ESMStore& store = mStore; const MWWorld::ESMStore& store = mStore;
ESM::RecNameInts foundType = static_cast<ESM::RecNameInts>(store.find(ref.mBaseObj)); ESM::RecNameInts foundType = static_cast<ESM::RecNameInts>(store.find(ref.mBaseObj));
Misc::tupleForEach(this->mCellStoreImp->mRefLists, [&ref, &deleted, &store, foundType](auto& x) { Misc::tupleForEach(this->mCellStoreImp->mRefLists, [&ref, &store, foundType](auto& x) {
recNameSwitcher( recNameSwitcher(x, foundType, [&ref, &store](auto& storeIn) { storeIn.load(ref, store); });
x, foundType, [&ref, &deleted, &store](auto& storeIn) { storeIn.load(ref, deleted, store); });
}); });
} }

View File

@ -419,7 +419,7 @@ namespace MWWorld
void loadRefs(); 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<ESM::RefNum, ESM::RefId>& refNumToID); void loadRef(ESM::CellRef& ref, bool deleted, std::map<ESM::RefNum, ESM::RefId>& refNumToID);
///< Make case-adjustments to \a ref and insert it into the respective container. ///< Make case-adjustments to \a ref and insert it into the respective container.
/// ///

View File

@ -85,13 +85,13 @@ namespace MWWorld
{ {
} }
RefData::RefData(const ESM4::Reference& cellRef) RefData::RefData(const ESM4::Reference& ref)
: mBaseNode(nullptr) : mBaseNode(nullptr)
, mDeletedByContentFile(false) , mDeletedByContentFile(ref.mFlags & ESM4::Rec_Deleted)
, mEnabled(true) , mEnabled(!(ref.mFlags & ESM4::Rec_Disabled))
, mPhysicsPostponed(false) , mPhysicsPostponed(false)
, mCount(1) , mCount(ref.mCount)
, mPosition(cellRef.mPos) , mPosition(ref.mPos)
, mCustomData(nullptr) , mCustomData(nullptr)
, mChanged(false) , mChanged(false)
, mFlags(0) , mFlags(0)