From 6adf7b10ae377736fa2085aaccb152278efe8e24 Mon Sep 17 00:00:00 2001
From: elsid <elsid.mail@gmail.com>
Date: Tue, 27 Jul 2021 20:08:36 +0200
Subject: [PATCH] Fix removing heightfield from navigator

It's added not as object so it shouldn't be removed as it.
---
 apps/openmw/mwworld/scene.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp
index 1dc0f904bc..3111a28f04 100644
--- a/apps/openmw/mwworld/scene.cpp
+++ b/apps/openmw/mwworld/scene.cpp
@@ -397,8 +397,8 @@ namespace MWWorld
 
         if (cell->getCell()->isExterior())
         {
-            if (const auto heightField = mPhysics->getHeightField(cellX, cellY))
-                mNavigator.removeObject(DetourNavigator::ObjectId(heightField));
+            if (mPhysics->getHeightField(cellX, cellY) != nullptr)
+                mNavigator.removeHeightfield(osg::Vec2i(cellX, cellY));
         }
 
         if (cell->getCell()->hasWater())