1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-01 15:09:43 +00:00

getExteriorCellLocation() added to MWWorld::Cell

This commit is contained in:
florent.teppe 2023-05-12 22:54:52 +02:00
parent a3bd6e7e47
commit 7c6471b0dc
3 changed files with 8 additions and 2 deletions

View file

@ -77,4 +77,9 @@ namespace MWWorld
else else
return mId; return mId;
} }
ESM::ExteriorCellLocation Cell::getExteriorCellLocation() const
{
return { mGridPos.x(), mGridPos.y(), getWorldSpace() };
}
} }

View file

@ -5,6 +5,7 @@
#include <components/esm/esmbridge.hpp> #include <components/esm/esmbridge.hpp>
#include <components/esm/refid.hpp> #include <components/esm/refid.hpp>
#include <components/esm/util.hpp>
namespace ESM namespace ESM
{ {
@ -48,6 +49,7 @@ namespace MWWorld
float getWaterHeight() const { return mWaterHeight; } float getWaterHeight() const { return mWaterHeight; }
const ESM::RefId& getId() const { return mId; } const ESM::RefId& getId() const { return mId; }
ESM::RefId getWorldSpace() const; ESM::RefId getWorldSpace() const;
ESM::ExteriorCellLocation getExteriorCellLocation() const;
private: private:
bool mIsExterior; bool mIsExterior;

View file

@ -252,8 +252,7 @@ namespace
for (auto* cell : collection) for (auto* cell : collection)
{ {
assert(cell->getCell()->isExterior()); assert(cell->getCell()->isExterior());
if (cellIndex.mX == cell->getCell()->getGridX() && cellIndex.mY == cell->getCell()->getGridY() if (cellIndex == cell->getCell()->getExteriorCellLocation())
&& cell->getCell()->getWorldSpace() == cellIndex.mWorldspace)
return true; return true;
} }
return false; return false;