summaryrefslogtreecommitdiff
path: root/src/roadveh_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/roadveh_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/roadveh_gui.cpp')
-rw-r--r--src/roadveh_gui.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp
index 439151eca..765bb36d5 100644
--- a/src/roadveh_gui.cpp
+++ b/src/roadveh_gui.cpp
@@ -27,12 +27,18 @@ void DrawRoadVehDetails(const Vehicle *v, int x, int y)
if (RoadVehHasArticPart(v)) {
AcceptedCargo max_cargo;
+ StringID subtype_text[NUM_CARGO];
char capacity[512];
memset(max_cargo, 0, sizeof(max_cargo));
+ memset(subtype_text, 0, sizeof(subtype_text));
for (const Vehicle *u = v; u != NULL; u = u->Next()) {
max_cargo[u->cargo_type] += u->cargo_cap;
+ if (u->cargo_cap > 0) {
+ StringID text = GetCargoSubtypeText(u);
+ if (text != STR_EMPTY) subtype_text[u->cargo_type] = text;
+ }
}
GetString(capacity, STR_ARTICULATED_RV_CAPACITY, lastof(capacity));
@@ -48,6 +54,12 @@ void DrawRoadVehDetails(const Vehicle *v, int x, int y)
if (!first) strecat(capacity, ", ", lastof(capacity));
strecat(capacity, buffer, lastof(capacity));
+
+ if (subtype_text[i] != 0) {
+ GetString(buffer, subtype_text[i], lastof(buffer));
+ strecat(capacity, buffer, lastof(capacity));
+ }
+
first = false;
}
}
@@ -75,6 +87,7 @@ void DrawRoadVehDetails(const Vehicle *v, int x, int y)
} else {
SetDParam(0, v->cargo_type);
SetDParam(1, v->cargo_cap);
+ SetDParam(2, GetCargoSubtypeText(v));
DrawString(x, y + 10 + y_offset, STR_9012_CAPACITY, TC_FROMSTRING);
str = STR_8812_EMPTY;