(svn r4872) - NewGRF: add support for vehicle variable 0x47 (mart3p)
authorpeter1138
Mon, 15 May 2006 06:49:36 +0000
changeset 3848 ad94e6144369
parent 3847 2605e667c3bb
child 3849 2a840dc75e10
(svn r4872) - NewGRF: add support for vehicle variable 0x47 (mart3p)
newgrf_engine.c
--- a/newgrf_engine.c	Sun May 14 23:01:11 2006 +0000
+++ b/newgrf_engine.c	Mon May 15 06:49:36 2006 +0000
@@ -587,6 +587,18 @@
 		case 0x46: /* Motion counter */
 			return 0;
 
+		case 0x47: { /* Vehicle cargo info */
+			/* Format: ccccwwtt
+			 * tt - the cargo type transported by the vehicle,
+			 *     translated if a translation table has been installed.
+			 * ww - cargo unit weight in 1/16 tons, same as cargo prop. 0F.
+			 * cccc - the cargo class value of the cargo transported by the vehicle.
+			 */
+			CargoID cid = _global_cargo_id[_opt.landscape][v->cargo_type];
+
+			return (_cargo_classes[cid] << 16) | (_cargoc.weights[v->cargo_type] << 8) | cid;
+		}
+
 		/* Variables which use the parameter */
 		case 0x60: /* Count consist's engine ID occurance */
 			if (v->type != VEH_Train) return v->engine_type == parameter;