1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-04 02:41:19 +00:00

Merge branch 'fix_pathgrid_path' into 'master'

Use pathgrid path when destination is closer to different graph component node

See merge request OpenMW/openmw!1155
This commit is contained in:
psi29a 2021-09-08 09:55:42 +00:00
commit 4bf22f3ca0

View File

@ -206,9 +206,6 @@ namespace MWMechanics
endPointInLocalCoords, endPointInLocalCoords,
startNode); startNode);
if (!endNode.second)
return;
// if it's shorter for actor to travel from start to end, than to travel from either // 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. // start or end to nearest pathgrid point, just travel from start to end.
float startToEndLength2 = (endPointInLocalCoords - startPointInLocalCoords).length2(); float startToEndLength2 = (endPointInLocalCoords - startPointInLocalCoords).length2();
@ -279,7 +276,8 @@ namespace MWMechanics
// unreachable pathgrid point. // unreachable pathgrid point.
// //
// The AI routines will have to deal with such situations. // 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 float PathFinder::getZAngleToNext(float x, float y) const