Changeset - r19049:47de46c9ad63
[Not reviewed]
master
0 1 0
frosch - 12 years ago 2012-02-08 18:11:49
frosch@openttd.org
(svn r23917) -Fix (r11252,, r23914, r23915): Also use the CTT for refitmasks for version 6 GRFs. I.e. fix the cursed GetCargoTranslation() function for the fourth time.
1 file changed with 10 insertions and 13 deletions:
0 comments (0 inline, 0 general)
src/newgrf_cargo.cpp
Show inline comments
 
@@ -111,21 +111,18 @@ uint16 GetCargoCallback(CallbackID callb
 
 */
 
CargoID GetCargoTranslation(uint8 cargo, const GRFFile *grffile, bool usebit)
 
{
 
	/* Pre-version 7 uses the 'climate dependent' ID, i.e. cargo is the cargo ID */
 
	if (grffile->grf_version < 7) {
 
		if (!usebit) return 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) {
 
		/* ...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' */
 
		return GetCargoIDByBitnum(cargo);
 
	} else {
 
		/* 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' */
 
			return GetCargoIDByBitnum(cargo);
 
		}
 
	}
 
	return CT_INVALID;
 
}
0 comments (0 inline, 0 general)