(svn r17592) -Fix [FS#3212](r17436): force all cargo being accepted when industry tiles accept it but industry itself doesn't

This commit is contained in:
smatz
2009-09-20 18:52:12 +00:00
parent 12ef0046dd
commit 9cf2e92159
4 changed files with 25 additions and 4 deletions

View File

@@ -429,9 +429,30 @@ static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray &acceptance, ui
}
}
const Industry *ind = Industry::GetByTile(tile);
for (byte i = 0; i < lengthof(itspec->accepts_cargo); i++) {
CargoID a = accepts_cargo[i];
if (a != CT_INVALID) acceptance[a] += cargo_acceptance[i];
if (a == CT_INVALID) continue; // work only with valid cargos
/* Add accepted cargo */
acceptance[a] += cargo_acceptance[i];
/* Maybe set 'always accepted' bit (if it's not set already) */
if (HasBit(*always_accepted, a)) continue;
bool accepts = false;
for (uint cargo_index = 0; cargo_index < lengthof(ind->accepts_cargo); cargo_index++) {
/* Test whether the industry itself accepts the cargo type */
if (ind->accepts_cargo[cargo_index] == a) {
accepts = true;
break;
}
}
if (accepts) continue;
/* If the industry itself doesn't accept this cargo, set 'always accepted' bit */
SetBit(*always_accepted, a);
}
}