summaryrefslogtreecommitdiff
path: root/economy.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
commitbb680056b1004ca5e8e74786764061aeedf9c188 (patch)
treec97da17a330889a788b8654dddbc7507d01b3b38 /economy.c
parent77072aedabd1e5acd2d380defac707c88d287c88 (diff)
downloadopenttd-bb680056b1004ca5e8e74786764061aeedf9c188.tar.xz
(svn r1749) Move the functions which calculate distances to map.[ch] and give the more meaningful names
Diffstat (limited to 'economy.c')
-rw-r--r--economy.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/economy.c b/economy.c
index b8c6ebb39..cc92b64db 100644
--- a/economy.c
+++ b/economy.c
@@ -896,7 +896,7 @@ static void FindSubsidyPassengerRoute(FoundRoute *fr)
if (from==to || to->xy == 0 || to->population < 400 || to->pct_pass_transported > 42)
return;
- fr->distance = GetTileDist(from->xy, to->xy);
+ fr->distance = DistanceManhattan(from->xy, to->xy);
}
static void FindSubsidyCargoRoute(FoundRoute *fr)
@@ -937,7 +937,7 @@ static void FindSubsidyCargoRoute(FoundRoute *fr)
// Only want big towns
if (t->xy == 0 || t->population < 900)
return;
- fr->distance = GetTileDist(i->xy, t->xy);
+ fr->distance = DistanceManhattan(i->xy, t->xy);
fr->to = t;
} else {
// The destination is an industry
@@ -949,7 +949,7 @@ static void FindSubsidyCargoRoute(FoundRoute *fr)
cargo != i2->accepts_cargo[1] &&
cargo != i2->accepts_cargo[2]))
return;
- fr->distance = GetTileDist(i->xy, i2->xy);
+ fr->distance = DistanceManhattan(i->xy, i2->xy);
fr->to = i2;
}
}
@@ -1132,7 +1132,7 @@ static void DeliverGoodsToIndustry(TileIndex xy, byte cargo_type, int num_pieces
== ind->accepts_cargo[1] || cargo_type == ind->accepts_cargo[2]) &&
ind->produced_cargo[0] != 0xFF &&
ind->produced_cargo[0] != cargo_type &&
- (t=GetTileDist(ind->xy, xy)) < u) {
+ (t = DistanceManhattan(ind->xy, xy)) < u) {
u = t;
best = ind;
}
@@ -1171,7 +1171,7 @@ static bool CheckSubsidised(Station *from, Station *to, byte cargo_type)
} else {
xy = (GetIndustry(s->from))->xy;
}
- if (GetTileDist1D(xy, from->xy) > 9)
+ if (DistanceMax(xy, from->xy) > 9)
continue;
/* Check distance from dest */
@@ -1181,7 +1181,7 @@ static bool CheckSubsidised(Station *from, Station *to, byte cargo_type)
xy = (GetIndustry(s->to))->xy;
}
- if (GetTileDist1D(xy, to->xy) > 9)
+ if (DistanceMax(xy, to->xy) > 9)
continue;
/* Found a subsidy, change the values to indicate that it's in use */
@@ -1242,7 +1242,7 @@ static int32 DeliverGoods(int num_pieces, byte cargo_type, byte source, byte des
// Determine profit
{
- int t = GetTileDist(s_from->xy, s_to->xy);
+ int t = DistanceManhattan(s_from->xy, s_to->xy);
int r = num_pieces;
profit = 0;
do {