@@ -113,16 +113,16 @@ CargoID GetCargoTranslation(uint8 cargo,
{
/* Pre-version 7 uses the 'climate dependent' ID in callbacks and properties, i.e. cargo is the cargo ID */
if (grffile->grf_version < 7 && !usebit) return cargo;
/* Other cases use (possibly translated) cargobits */
if (grffile->cargo_max > 0) {
if (grffile->cargo_list.Length() > 0) {
/* ...and the cargo is in bounds, then get the cargo ID for
* the label */
if (cargo < grffile->cargo_max) return GetCargoIDByLabel(grffile->cargo_list[cargo]);
if (cargo < grffile->cargo_list.Length()) return GetCargoIDByLabel(grffile->cargo_list[cargo]);
} else {
/* Else the cargo value is a 'climate independent' 'bitnum' */
return GetCargoIDByBitnum(cargo);
}
return CT_INVALID;