From e80f3390863aa4a722b0d7516cca7420b12df53a Mon Sep 17 00:00:00 2001 From: yexo Date: Sat, 7 Aug 2010 20:11:27 +0000 Subject: (svn r20396) -Codechange: introduce a helper function to test whether an industry temporarily refues to accept some cargo --- src/industry_cmd.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/industry_cmd.cpp') 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; -- cgit v1.2.3-54-g00ecf