From 84fbb486d3f534ef357a440a71ac9e3c8d0b4bde Mon Sep 17 00:00:00 2001 From: elsid Date: Mon, 4 Mar 2019 22:51:31 +0300 Subject: [PATCH] Fix switch from invalid navmesh number to valid --- apps/openmw/mwrender/navmesh.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwrender/navmesh.cpp b/apps/openmw/mwrender/navmesh.cpp index 331f506ab..bfc80914a 100644 --- a/apps/openmw/mwrender/navmesh.cpp +++ b/apps/openmw/mwrender/navmesh.cpp @@ -34,7 +34,7 @@ namespace MWRender void NavMesh::update(const dtNavMesh& navMesh, const std::size_t id, const std::size_t generation, const std::size_t revision, const DetourNavigator::Settings& settings) { - if (!mEnabled || (mId == id && mGeneration >= generation && mRevision >= revision)) + if (!mEnabled || (mGroup && mId == id && mGeneration >= generation && mRevision >= revision)) return; mId = id; @@ -53,7 +53,10 @@ namespace MWRender void NavMesh::reset() { if (mGroup) + { mRootNode->removeChild(mGroup); + mGroup = nullptr; + } } void NavMesh::enable() @@ -65,7 +68,8 @@ namespace MWRender void NavMesh::disable() { - reset(); + if (mGroup) + mRootNode->removeChild(mGroup); mEnabled = false; } }