From 9112c65afcfb8c9826a6a285ae72941fa94f14a7 Mon Sep 17 00:00:00 2001 From: elsid Date: Wed, 18 Aug 2021 19:52:08 +0200 Subject: [PATCH] Use pathgrid path when destination is closer to different graph component node Partially revert d863267d5cb5f4062937f86c37af3b0c8f9479cf to restore 0.46 behaviour for pathgrid based pathfinding. --- apps/openmw/mwmechanics/pathfinding.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwmechanics/pathfinding.cpp b/apps/openmw/mwmechanics/pathfinding.cpp index 2f8e830434..0e704cd466 100644 --- a/apps/openmw/mwmechanics/pathfinding.cpp +++ b/apps/openmw/mwmechanics/pathfinding.cpp @@ -206,9 +206,6 @@ namespace MWMechanics endPointInLocalCoords, startNode); - if (!endNode.second) - return; - // if it's shorter for actor to travel from start to end, than to travel from either // start or end to nearest pathgrid point, just travel from start to end. float startToEndLength2 = (endPointInLocalCoords - startPointInLocalCoords).length2(); @@ -279,7 +276,8 @@ namespace MWMechanics // unreachable pathgrid point. // // The AI routines will have to deal with such situations. - *out++ = endPoint; + if (endNode.second) + *out++ = endPoint; } float PathFinder::getZAngleToNext(float x, float y) const