diff options
Diffstat (limited to 'path.h')
| -rw-r--r-- | path.h | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -10,7 +10,7 @@ extern char *path_func_string; /* Time it took to calculate a path */ extern double path_time; -/* Controls whether walls should wrap around, only works in Dijkstra's */ +/* Controls whether walls should wrap around, only works in Dijkstra's due to A*'s heuristic */ extern char wraparound_enabled; /* dirs can be 4 or 8 to disallow or allow diagonal movement */ @@ -18,8 +18,10 @@ extern char wraparound_enabled; Path dijkstra_path(int dirs, Map map, size_t **cell_costs, size_t width, size_t height, Position start, Position end, char **visited, char should_anim); Path astar_path(int dirs, Map map, size_t **cell_costs, size_t width, size_t height, Position start, Position end, char **visited, char should_anim); -size_t manhattan_distance(Position a, Position b); -size_t diagonal_distance(Position a, Position b); +/* Heuristic functions. Calculate the distance from a to b */ +size_t manhattan_distance(Position a, Position b); /* Used for 4 dirs */ +size_t diagonal_distance(Position a, Position b); /* Used for 8 dirs */ + Path path_new(size_t width, size_t height); void path_free(Path path, size_t height); |
