From 6c11cb80fea2db7c49424b28ce26616de6190b1f Mon Sep 17 00:00:00 2001 From: bsxf47 Date: Thu, 8 Sep 2016 18:15:55 +0200 Subject: [PATCH] Do not return blocked nodes as pathfinder goals Blocked nodes get skipped by the pathfinding algorithm, resulting in failure. GetNearestNode() now returns the nearest node that is not blocked. Partially fixes Issue #652 --- src/ai/PathFinder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ai/PathFinder.cpp b/src/ai/PathFinder.cpp index 7ede0484bb..1eab120302 100644 --- a/src/ai/PathFinder.cpp +++ b/src/ai/PathFinder.cpp @@ -383,7 +383,7 @@ PathFinder::NodeId PathFinder::getNearestNode(const Vec3f & pos) const { for(size_t i = 0; i < map_s; i++) { float dist = arx::distance2(map_d[i].pos, pos); - if(dist < distance && map_d[i].nblinked) { + if(dist < distance && map_d[i].nblinked && !(map_d[i].flags & ANCHOR_FLAG_BLOCKED)) { best = i; distance = dist; }