Codechange: Make more use of GetCargoAccepted/ProducedIndex().

This commit is contained in:
Peter Nelson
2023-05-24 00:52:11 +01:00
committed by PeterN
parent 29b20718ba
commit 633f19419d
2 changed files with 16 additions and 25 deletions

View File

@@ -1017,12 +1017,9 @@ static uint DeliverGoodsToIndustry(const Station *st, CargoID cargo_type, uint n
Industry *ind = i.industry;
if (ind->index == source) continue;
uint cargo_index;
for (cargo_index = 0; cargo_index < lengthof(ind->accepts_cargo); cargo_index++) {
if (cargo_type == ind->accepts_cargo[cargo_index]) break;
}
int cargo_index = ind->GetCargoAcceptedIndex(cargo_type);
/* Check if matching cargo has been found */
if (cargo_index >= lengthof(ind->accepts_cargo)) continue;
if (cargo_index < 0) continue;
/* Check if industry temporarily refuses acceptance */
if (IndustryTemporarilyRefusesCargo(ind, cargo_type)) continue;