MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / GetPath

Function GetPath

Source/engine/path.cpp:296–309  ·  view source on GitHub ↗

* @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 */

Source from the content-addressed store, hash-verified

294 * @return false if we ran out of preallocated nodes to use, else true
295 */
296bool 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

Callers 1

FindPathFunction · 0.85

Calls 3

path_solid_piecesFunction · 0.85
ParentPathFunction · 0.85
positionMethod · 0.80

Tested by

no test coverage detected