summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-04-21 20:25:34 +0000
committercelestar <celestar@openttd.org>2006-04-21 20:25:34 +0000
commitf8b652576526e39dad1b088e7d8c487300e7410b (patch)
tree1d75cd673f3b715a543e14a37545f1bc60c69fac
parent1e574a6afc2a79914ec50c332d7862b88e8a2393 (diff)
downloadopenttd-f8b652576526e39dad1b088e7d8c487300e7410b.tar.xz
(svn r4508) -Fix: (FS#125) Fixed a problem that caused DeliverGoodsToIndustry to not work as intended. Note: write something better for this entire function
-rw-r--r--economy.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/economy.c b/economy.c
index 7e7446b46..1d540b870 100644
--- a/economy.c
+++ b/economy.c
@@ -1110,7 +1110,10 @@ static void DeliverGoodsToIndustry(TileIndex xy, CargoID cargo_type, int num_pie
uint u;
// Check if there's an industry close to the station that accepts the cargo
- u = _patches.station_spread + 8;
+ // XXX - Think of something better to
+ // 1) Only deliver to industries which are withing the catchment radius
+ // 2) Distribute between industries if more then one is present
+ u = (_patches.station_spread + 8) * 2;
FOR_ALL_INDUSTRIES(ind) {
uint t;
@@ -1121,7 +1124,7 @@ static void DeliverGoodsToIndustry(TileIndex xy, CargoID cargo_type, int num_pie
) &&
ind->produced_cargo[0] != CT_INVALID &&
ind->produced_cargo[0] != cargo_type &&
- (t = DistanceManhattan(ind->xy, xy)) < 2 * u) {
+ (t = DistanceManhattan(ind->xy, xy)) < u) {
u = t;
best = ind;
}