From 7bbcf5875c2fc6a8fa80e417d65e1094947d78b8 Mon Sep 17 00:00:00 2001 From: tron Date: Mon, 31 Jan 2005 07:23:15 +0000 Subject: (svn r1749) Move the functions which calculate distances to map.[ch] and give the more meaningful names --- roadveh_cmd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'roadveh_cmd.c') diff --git a/roadveh_cmd.c b/roadveh_cmd.c index d69894530..2297f6ab2 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -651,7 +651,7 @@ static void ProcessRoadVehOrder(Vehicle *v) dist = malloc(num * sizeof(int32)); do { - *dist = GetTileDistAdv(v->tile, rs->xy); + *dist = DistanceSquare(v->tile, rs->xy); if (*dist < mindist) { v->dest_tile = rs->xy; } @@ -999,7 +999,7 @@ typedef struct { static bool EnumRoadTrackFindDist(uint tile, FindRoadToChooseData *frd, int track, uint length, byte *state) { - uint dist = GetTileDist(tile, frd->dest); + uint dist = DistanceManhattan(tile, frd->dest); if (dist <= frd->mindist) { if (dist != frd->mindist || length < frd->maxtracklen) { frd->maxtracklen = length; @@ -1577,9 +1577,9 @@ static void CheckIfRoadVehNeedsService(Vehicle *v) i = FindClosestRoadDepot(v); - if (i < 0 || GetTileDist(v->tile, (&_depots[i])->xy) > 12) { + if (i < 0 || DistanceManhattan(v->tile, (&_depots[i])->xy) > 12) { if (v->current_order.type == OT_GOTO_DEPOT && !( - GetTileDist(v->tile, v->dest_tile) > 25 && v->set_for_replacement)) { + DistanceManhattan(v->tile, v->dest_tile) > 25 && v->set_for_replacement)) { /* a vehicle needs a greater distance to a depot to loose it than to find it since they can circle forever othervise if they are in a loop with an unlucky distance */ v->current_order.type = OT_DUMMY; -- cgit v1.2.3-54-g00ecf