summaryrefslogtreecommitdiff
path: root/src/economy.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-07-08 17:40:04 +0000
committerrubidium <rubidium@openttd.org>2007-07-08 17:40:04 +0000
commit283a06e4a195fabea413c55e236586a880c794f6 (patch)
treee8b08f0eebf44557962f1210eb8b7887d9d999bf /src/economy.cpp
parentfd2d67784911fc545883f3911790ecc38d43e0e0 (diff)
downloadopenttd-283a06e4a195fabea413c55e236586a880c794f6.tar.xz
(svn r10477) -Codechange: add some callbacks to customise the acceptance of industries.
Diffstat (limited to 'src/economy.cpp')
-rw-r--r--src/economy.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 46f3c14d6..713af79a7 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1211,18 +1211,18 @@ static void DeliverGoodsToIndustry(TileIndex xy, CargoID cargo_type, int num_pie
indspec = GetIndustrySpec(ind->type);
uint i;
- if (indspec->produced_cargo[0] == CT_INVALID) continue;
-
for (i = 0; i < lengthof(indspec->accepts_cargo); i++) {
- if (cargo_type == indspec->accepts_cargo[i] &&
- (indspec->input_cargo_multiplier[i][0] != 0 || indspec->input_cargo_multiplier[i][1] != 0)) {
- break;
- }
+ if (cargo_type == indspec->accepts_cargo[i]) break;
}
/* Check if matching cargo has been found */
if (i == lengthof(indspec->accepts_cargo)) continue;
+ if (HASBIT(indspec->callback_flags, CBM_IND_REFUSE_CARGO)) {
+ uint16 res = GetIndustryCallback(CBID_INDUSTRY_REFUSE_CARGO, 0, GetReverseCargoTranslation(cargo_type, indspec->grf_prop.grffile), ind, ind->type, ind->xy);
+ if (res == 0) continue;
+ }
+
uint dist = DistanceManhattan(ind->xy, xy);
if (dist < best_dist) {