Codechange: Add IsCargoAccepted/Produced() helpers.

This commit is contained in:
Peter Nelson
2023-05-24 00:52:44 +01:00
committed by PeterN
parent 633f19419d
commit 09408e8e46
9 changed files with 40 additions and 65 deletions

View File

@@ -67,14 +67,10 @@
Industry *i = ::Industry::Get(industry_id);
for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
if (i->accepts_cargo[j] == cargo_id) {
if (IndustryTemporarilyRefusesCargo(i, cargo_id)) return CAS_TEMP_REFUSED;
return CAS_ACCEPTED;
}
}
if (!i->IsCargoAccepted(cargo_id)) return CAS_NOT_ACCEPTED;
if (IndustryTemporarilyRefusesCargo(i, cargo_id)) return CAS_TEMP_REFUSED;
return CAS_NOT_ACCEPTED;
return CAS_ACCEPTED;
}
/* static */ SQInteger ScriptIndustry::GetStockpiledCargo(IndustryID industry_id, CargoID cargo_id)