diff src/vehicle_gui.cpp @ 11133:ec305342a11e draft

(svn r15480) -Feature(tte): Show the cargo subtype in the vehicle details window.
author michi_cc <michi_cc@openttd.org>
date Sat, 14 Feb 2009 18:42:03 +0000 (2009-02-14)
parents 8da1855e9f14
children 06dac7488367
line wrap: on
line diff
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -494,6 +494,17 @@
 	return DrawStringMultiLine(x, y, STR_JUST_RAW_STRING, w);
 }
 
+/** Get the cargo subtype text from NewGRF for the vehicle details window. */
+StringID GetCargoSubtypeText(const Vehicle *v)
+{
+	if (HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_CARGO_SUFFIX)) {
+		uint16 cb = GetVehicleCallback(CBID_VEHICLE_CARGO_SUFFIX, 0, 0, v->engine_type, v);
+		if (cb != CALLBACK_FAILED) {
+			return GetGRFStringID(GetEngineGRFID(v->engine_type), 0xD000 + cb);
+		}
+	}
+	return STR_EMPTY;
+}
 
 /** Sort vehicles by their number */
 static int CDECL VehicleNumberSorter(const Vehicle * const *a, const Vehicle * const *b)