From bab2ff2090e875ec5c0465e0d39011b0382d4c9e Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Wed, 15 Apr 2026 17:38:50 +0300 Subject: Add costs everywhere --- path.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'path.h') diff --git a/path.h b/path.h index 6b4dda6..3bf4af4 100644 --- a/path.h +++ b/path.h @@ -5,12 +5,12 @@ #include "map.h" /* The currently chosen path func */ -extern Path (*path_func)(int, Map, size_t, size_t, Position, Position, char **, char); +extern Path (*path_func)(int, Map, size_t **, size_t, size_t, Position, Position, char **, char); /* dirs can be 4 or 8 to disallow or allow diagonal movement */ -Path breadth_first_search_path(int dirs, Map map, size_t width, size_t height, Position start, Position end, char **visited, char should_anim); -Path dijkstra_path(int dirs, Map map, size_t width, size_t height, Position start, Position end, char **visited, char should_anim); -Path astar_path(int dirs, Map map, size_t width, size_t height, Position start, Position end, char **visited, char should_anim); +Path breadth_first_search_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 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); @@ -26,8 +26,8 @@ void visited_clear(char **visited, size_t width, size_t height); void visited_free(char **visited, size_t height); size_t visited_count(char **visited, size_t width, size_t height); -/* Helper funcs for the cost_so_far array */ -size_t **cost_so_far_new(size_t width, size_t height); -void cost_so_far_free(size_t **cost_so_far, size_t height); +/* Helper funcs for the cost arrays */ +size_t **cost_new(size_t width, size_t height); +void cost_free(size_t **cost, size_t height); #endif /* ASTAR_H_ */ -- cgit v1.2.3