diff options
author | yexo <yexo@openttd.org> | 2010-08-07 20:11:27 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-08-07 20:11:27 +0000 |
commit | e80f3390863aa4a722b0d7516cca7420b12df53a (patch) | |
tree | 6696408aa41b164d70f99c01ef97ee11a364ae1b /src/industry_cmd.cpp | |
parent | 50fe2264ec43f72648518ea18551c851624396fd (diff) | |
download | openttd-e80f3390863aa4a722b0d7516cca7420b12df53a.tar.xz |
(svn r20396) -Codechange: introduce a helper function to test whether an industry temporarily refues to accept some cargo
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r-- | src/industry_cmd.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index fea6e5d7e..8e893d6fe 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -2065,18 +2065,11 @@ static bool CheckIndustryCloseDownProtection(IndustryType type) */ static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accepts, bool *c_produces) { - const IndustrySpec *indspec = GetIndustrySpec(ind->type); + if (cargo == CT_INVALID) return; /* Check for acceptance of cargo */ for (byte j = 0; j < lengthof(ind->accepts_cargo); j++) { - if (ind->accepts_cargo[j] == CT_INVALID) continue; - if (cargo == ind->accepts_cargo[j]) { - if (HasBit(indspec->callback_mask, CBM_IND_REFUSE_CARGO)) { - uint16 res = GetIndustryCallback(CBID_INDUSTRY_REFUSE_CARGO, - 0, GetReverseCargoTranslation(cargo, indspec->grf_prop.grffile), - ind, ind->type, ind->location.tile); - if (res == 0) continue; - } + if (cargo == ind->accepts_cargo[j] && !IndustryTemporarilyRefusesCargo(ind, cargo)) { *c_accepts = true; break; } @@ -2084,7 +2077,6 @@ static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accept /* Check for produced cargo */ for (byte j = 0; j < lengthof(ind->produced_cargo); j++) { - if (ind->produced_cargo[j] == CT_INVALID) continue; if (cargo == ind->produced_cargo[j]) { *c_produces = true; break; |