summaryrefslogtreecommitdiff
path: root/roadveh_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-31 07:23:15 +0000
committertron <tron@openttd.org>2005-01-31 07:23:15 +0000
commit7bbcf5875c2fc6a8fa80e417d65e1094947d78b8 (patch)
treec97da17a330889a788b8654dddbc7507d01b3b38 /roadveh_cmd.c
parente1c19367f0cebbe90596319e9f82d959fa54621c (diff)
downloadopenttd-7bbcf5875c2fc6a8fa80e417d65e1094947d78b8.tar.xz
(svn r1749) Move the functions which calculate distances to map.[ch] and give the more meaningful names
Diffstat (limited to 'roadveh_cmd.c')
-rw-r--r--roadveh_cmd.c8
1 files changed, 4 insertions, 4 deletions
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;