diff --git a/apps/openmw/mwworld/store.cpp b/apps/openmw/mwworld/store.cpp index dd42476f64..4f8e4daa48 100644 --- a/apps/openmw/mwworld/store.cpp +++ b/apps/openmw/mwworld/store.cpp @@ -1212,16 +1212,15 @@ namespace MWWorld void Store::insertCell(ESM4::Cell* cellPtr) { + // Do not index exterior cells with Rec_Persistent flag because they are not real cells. + // References from these cells are merged into normal cells. + if (cellPtr->isExterior() && cellPtr->mFlags & ESM4::Rec_Persistent) + return; + if (!cellPtr->mEditorId.empty()) mCellNameIndex[cellPtr->mEditorId] = cellPtr; if (cellPtr->isExterior()) - { - ESM::ExteriorCellLocation cellindex = { cellPtr->mX, cellPtr->mY, cellPtr->mParent }; - if (cellPtr->mCellFlags & ESM4::Rec_Persistent) - mPersistentExteriors[cellindex] = cellPtr; - else - mExteriors[cellindex] = cellPtr; - } + mExteriors[ESM::ExteriorCellLocation(cellPtr->mX, cellPtr->mY, cellPtr->mParent)] = cellPtr; } void Store::clearDynamic() diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index 453f36db11..238c5cbd5f 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -291,9 +291,7 @@ namespace MWWorld { std::unordered_map mCellNameIndex; - std::unordered_map mExteriors; - std::unordered_map mPersistentExteriors; public: const ESM4::Cell* searchCellName(std::string_view) const;