MCPcopy Create free account
hub / github.com/diasurgical/devilution / path_check_equal

Function path_check_equal

Source/path.cpp:111–117  ·  view source on GitHub ↗

* @brief return 2 if pPath is horizontally/vertically aligned with (dx,dy), else 3 * * This approximates that diagonal movement on a square grid should have a cost * of sqrt(2). That's approximately 1.5, so they multiply all step costs by 2, * except diagonal steps which are times 3 */

Source from the content-addressed store, hash-verified

109 * except diagonal steps which are times 3
110 */
111int path_check_equal(PATHNODE *pPath, int dx, int dy)
112{
113 if (pPath->x == dx || pPath->y == dy)
114 return 2;
115
116 return 3;
117}
118
119/**
120 * @brief get the next node on the A* frontier to explore (estimated to be closest to the goal), mark it as visited, and return it

Callers 2

path_parent_pathFunction · 0.85
path_set_coordsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected