From 0da3ed44b904b3e5c8d61a236069b2fff1508a7f Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Sun, 29 Mar 2026 20:33:33 +0300 Subject: Make manhattan_distance() use COST_ORTHOGONAL --- path.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'path.c') diff --git a/path.c b/path.c index 64b2d95..bc3d6c5 100644 --- a/path.c +++ b/path.c @@ -8,6 +8,7 @@ #include "structs.h" #include "priority_queue.h" #include "error.h" +#include "config.h" /* TODO: somehow get offsets back to main */ int anim(Map map, size_t width, size_t height, Position start, Position end, Position *cur, char **visited, PositionPQ *frontier) { @@ -149,14 +150,14 @@ Path dijkstra_path(int dirs, Map map, size_t width, size_t height, Position star size_t manhattan_distance(Position a, Position b) { size_t d = 0; if (a.x > b.x) { - d += a.x - b.x; + d += (a.x - b.x) * COST_ORTHOGONAL; } else { - d += b.x - a.x; + d += (b.x - a.x) * COST_ORTHOGONAL; } if (a.y > b.y) { - d += a.y - b.y; + d += (a.y - b.y) * COST_ORTHOGONAL; } else { - d += b.y - a.y; + d += (b.y - a.y) * COST_ORTHOGONAL; } return d; } -- cgit v1.2.3