From 7c6471b0dc888b7e32602dc722b97ce89d52e6ab Mon Sep 17 00:00:00 2001 From: "florent.teppe" Date: Fri, 12 May 2023 22:54:52 +0200 Subject: [PATCH] getExteriorCellLocation() added to MWWorld::Cell --- apps/openmw/mwworld/cell.cpp | 5 +++++ apps/openmw/mwworld/cell.hpp | 2 ++ apps/openmw/mwworld/scene.cpp | 3 +-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwworld/cell.cpp b/apps/openmw/mwworld/cell.cpp index cf94f24f88..92b6ee9fc9 100644 --- a/apps/openmw/mwworld/cell.cpp +++ b/apps/openmw/mwworld/cell.cpp @@ -77,4 +77,9 @@ namespace MWWorld else return mId; } + + ESM::ExteriorCellLocation Cell::getExteriorCellLocation() const + { + return { mGridPos.x(), mGridPos.y(), getWorldSpace() }; + } } diff --git a/apps/openmw/mwworld/cell.hpp b/apps/openmw/mwworld/cell.hpp index eb5a4e0de7..827b360a4b 100644 --- a/apps/openmw/mwworld/cell.hpp +++ b/apps/openmw/mwworld/cell.hpp @@ -5,6 +5,7 @@ #include #include +#include namespace ESM { @@ -48,6 +49,7 @@ namespace MWWorld float getWaterHeight() const { return mWaterHeight; } const ESM::RefId& getId() const { return mId; } ESM::RefId getWorldSpace() const; + ESM::ExteriorCellLocation getExteriorCellLocation() const; private: bool mIsExterior; diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 1f4a7d526a..027e66a88a 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -252,8 +252,7 @@ namespace for (auto* cell : collection) { assert(cell->getCell()->isExterior()); - if (cellIndex.mX == cell->getCell()->getGridX() && cellIndex.mY == cell->getCell()->getGridY() - && cell->getCell()->getWorldSpace() == cellIndex.mWorldspace) + if (cellIndex == cell->getCell()->getExteriorCellLocation()) return true; } return false;