summaryrefslogtreecommitdiff
path: root/newgrf_engine.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-15 06:49:36 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-15 06:49:36 +0000
commitfa37809eb65024af01d3cfa763df09b13c04ce40 (patch)
treeadc2902039ad9cf1feae2b805448b6d6611a55b2 /newgrf_engine.c
parente48874936eef3f116a31ad863da866f894245d5f (diff)
downloadopenttd-fa37809eb65024af01d3cfa763df09b13c04ce40.tar.xz
(svn r4872) - NewGRF: add support for vehicle variable 0x47 (mart3p)
Diffstat (limited to 'newgrf_engine.c')
-rw-r--r--newgrf_engine.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/newgrf_engine.c b/newgrf_engine.c
index 2ce4d16e7..46af6e888 100644
--- a/newgrf_engine.c
+++ b/newgrf_engine.c
@@ -587,6 +587,18 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
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;