From 8282175440876b28d431167ee0702404b09bf2e6 Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Tue, 21 Apr 2026 18:27:53 +0300 Subject: Remove path_length() as it's unused and is obsolete --- path.c | 16 ---------------- path.h | 2 -- 2 files changed, 18 deletions(-) diff --git a/path.c b/path.c index dc31f18..d643167 100644 --- a/path.c +++ b/path.c @@ -309,22 +309,6 @@ size_t diagonal_distance(Position a, Position b) { return COST_ORTHOGONAL * (dx + dy) + (COST_DIAGONAL - 2 * COST_ORTHOGONAL) * min; } -size_t path_length(Path path, Position start, Position goal) { - size_t length = 0; - if (path != NULL) { - Position cur = goal; - while (cur.x != start.x || cur.y != start.y) { - if (cur.x - path[cur.y][cur.x].x == 0 || cur.y - path[cur.y][cur.x].y == 0) { - length += COST_ORTHOGONAL; - } else { - length += COST_DIAGONAL; - } - cur = path[cur.y][cur.x]; - } - } - return length; -} - Path path_new(size_t width, size_t height) { Path path = malloc(sizeof(Position*)*height); if (path == NULL) return NULL; diff --git a/path.h b/path.h index ab22f8b..ea812e8 100644 --- a/path.h +++ b/path.h @@ -20,8 +20,6 @@ size_t diagonal_distance(Position a, Position b); Path path_new(size_t width, size_t height); void path_free(Path path, size_t height); -size_t path_length(Path path, Position start, Position goal); - /* Helper funcs for the visited array */ char **visited_new(size_t width, size_t height); void visited_clear(char **visited, size_t width, size_t height); -- cgit v1.2.3