Skip to content

Commit

Permalink
Do not return blocked nodes as pathfinder goals
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bsxf-47 authored and dscharrer committed Apr 8, 2017
1 parent 807e52d commit 6c11cb8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ai/PathFinder.cpp
Expand Up @@ -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;
}
Expand Down

0 comments on commit 6c11cb8

Please sign in to comment.