diff options
Diffstat (limited to 'path.c')
| -rw-r--r-- | path.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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; } |
