1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 19:45:40 +00:00

Merge branch 'esm4_flags' into 'master'

Handle ESM4::Rec_Deleted and ESM4::Rec_Disabled flags. Fixes #7494.

Closes #7494

See merge request OpenMW/openmw!3260
This commit is contained in:
psi29a 2023-07-22 15:16:33 +00:00
commit 19940987a3
4 changed files with 12 additions and 15 deletions

View file

@ -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)
{

View file

@ -376,7 +376,7 @@ namespace MWWorld
}
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))
@ -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<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()
@ -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<ESM::RecNameInts>(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); });
});
}

View file

@ -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<ESM::RefNum, ESM::RefId>& refNumToID);
///< 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)
, 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)