diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index c94f16f5f6..5f13fef571 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -481,11 +481,9 @@ namespace MWPhysics mHeightFields.erase(heightfield); } - const HeightField* PhysicsSystem::getHeightField(ESM::ExteriorCellLocation cellIndex) const + const HeightField* PhysicsSystem::getHeightField(int x, int y) const { - if (ESM::isEsm4Ext(cellIndex.mWorldspace)) - return nullptr; - const auto heightField = mHeightFields.find(std::make_pair(cellIndex.mX, cellIndex.mY)); + const auto heightField = mHeightFields.find(std::make_pair(x, y)); if (heightField == mHeightFields.end()) return nullptr; return heightField->second.get(); diff --git a/apps/openmw/mwphysics/physicssystem.hpp b/apps/openmw/mwphysics/physicssystem.hpp index d73a87509e..e4c1b63776 100644 --- a/apps/openmw/mwphysics/physicssystem.hpp +++ b/apps/openmw/mwphysics/physicssystem.hpp @@ -189,7 +189,7 @@ namespace MWPhysics void removeHeightField(int x, int y); - const HeightField* getHeightField(ESM::ExteriorCellLocation cellIndex) const; + const HeightField* getHeightField(int x, int y) const; bool toggleCollisionMode(); diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 766aaf627e..78c8ccab1d 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -346,10 +346,7 @@ namespace MWWorld if (cell->getCell()->isExterior()) { - if (mPhysics->getHeightField(ESM::ExteriorCellLocation(cellX, cellY, cell->getCell()->getWorldSpace())) - != nullptr) - mNavigator.removeHeightfield(osg::Vec2i(cellX, cellY), navigatorUpdateGuard); - + mNavigator.removeHeightfield(osg::Vec2i(cellX, cellY), navigatorUpdateGuard); mPhysics->removeHeightField(cellX, cellY); } @@ -414,7 +411,7 @@ namespace MWWorld mPhysics->addHeightField(defaultHeight.data(), cellX, cellY, worldsize, verts, ESM::Land::DEFAULT_HEIGHT, ESM::Land::DEFAULT_HEIGHT, land.get()); } - if (const auto heightField = mPhysics->getHeightField(cellIndex)) + if (const auto heightField = mPhysics->getHeightField(cellX, cellY)) { const osg::Vec2i cellPosition(cellX, cellY); const btVector3& origin = heightField->getCollisionObject()->getWorldTransform().getOrigin(); @@ -469,7 +466,7 @@ namespace MWWorld if (cellVariant.isExterior()) { - if (const auto heightField = mPhysics->getHeightField(cellIndex)) + if (const auto heightField = mPhysics->getHeightField(cellX, cellY)) mNavigator.addWater( osg::Vec2i(cellX, cellY), ESM::Land::REAL_SIZE, waterLevel, navigatorUpdateGuard); }