summaryrefslogtreecommitdiff
path: root/src/vehicle_gui.cpp
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2009-02-14 18:42:03 +0000
committermichi_cc <michi_cc@openttd.org>2009-02-14 18:42:03 +0000
commit84deeecc5b21584b7aee023bb820671683cd7ef1 (patch)
tree698f73feb9c82404ea46d6d0fd869f31fe08842d /src/vehicle_gui.cpp
parentb123756c9f2e528c78531376c21112aed57d38a8 (diff)
downloadopenttd-84deeecc5b21584b7aee023bb820671683cd7ef1.tar.xz
(svn r15480) -Feature(tte): Show the cargo subtype in the vehicle details window.
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 5d57af7e1..b3a6c385a 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -494,6 +494,17 @@ uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine)
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)