Skip to content

Commit

Permalink
move check to child tile
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon committed Jun 4, 2024
1 parent 25083c1 commit e57064b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/pathfinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,6 @@ std::vector<tripoint> map::route( const tripoint &f, const tripoint &t,
continue;
}

if( cur != f && cur != t && avoid( cur ) ) {
layer.closed[parent_index] = true;
continue;
}


if( layer.gscore[parent_index] > max_length ) {
// Shortest path would be too long, return empty vector
return std::vector<tripoint>();
Expand Down Expand Up @@ -291,6 +285,11 @@ std::vector<tripoint> map::route( const tripoint &f, const tripoint &t,
continue;
}

if( p != t && avoid( p ) ) {
layer.closed[index] = true;
continue;
}

if( layer.closed[index] ) {
continue;
}
Expand Down

0 comments on commit e57064b

Please sign in to comment.