* @brief perform a single step of A* bread-first search by trying to step in every possible direction from pPath with goal (x,y). Check each step with PosOk * * @return false if we ran out of preallocated nodes to use, else true */
| 294 | * @return false if we ran out of preallocated nodes to use, else true |
| 295 | */ |
| 296 | bool GetPath(tl::function_ref<bool(Point)> posOk, uint16_t pathIndex, Point destination) |
| 297 | { |
| 298 | for (Displacement dir : PathDirs) { |
| 299 | const PathNode &path = PathNodes[pathIndex]; |
| 300 | const Point tile = path.position() + dir; |
| 301 | const bool ok = posOk(tile); |
| 302 | if ((ok && path_solid_pieces(path.position(), tile)) || (!ok && tile == destination)) { |
| 303 | if (!ParentPath(pathIndex, tile, destination)) |
| 304 | return false; |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | return true; |
| 309 | } |
| 310 | |
| 311 | } // namespace |
| 312 |
no test coverage detected