mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-13 07:10:57 +00:00
(svn r13855) -Fix [FS#2157]: Cargo type lookup was incorrect for GRFv7 files without a translation table.
This commit is contained in:
parent
78730d4c71
commit
81dafb5e69
@ -109,9 +109,15 @@ CargoID GetCargoTranslation(uint8 cargo, const GRFFile *grffile, bool usebit)
|
||||
/* Else the cargo value is a 'climate independent' 'bitnum' */
|
||||
if (HasBit(_cargo_mask, cargo)) return GetCargoIDByBitnum(cargo);
|
||||
} else {
|
||||
/* If the GRF contains a translation table (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 the GRF contains a translation table... */
|
||||
if (grffile->cargo_max > 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]);
|
||||
} else {
|
||||
/* Else the cargo value is a 'climate independent' 'bitnum' */
|
||||
if (HasBit(_cargo_mask, cargo)) return GetCargoIDByBitnum(cargo);
|
||||
}
|
||||
}
|
||||
return CT_INVALID;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user