From 01c410d6b14fa1da4a057c7f3c6a225e2969fbc2 Mon Sep 17 00:00:00 2001 From: Petr Mikheev Date: Mon, 29 May 2023 22:16:56 +0200 Subject: [PATCH] Remove `mPersistentExteriors` index; fix incorrect Rec_Persistent flag check. --- apps/openmw/mwworld/store.cpp | 13 ++++++------- apps/openmw/mwworld/store.hpp | 2 -- 2 files changed, 6 insertions(+), 9 deletions(-) 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;