summaryrefslogtreecommitdiff
path: root/src/vehicle_gui.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-01-12 19:58:06 +0000
committerpeter1138 <peter1138@openttd.org>2008-01-12 19:58:06 +0000
commit0f7392bd616e0bd256b5ec241ad52d7230bcc454 (patch)
treef23fb584e594e0c9ff5a9ad650d97c493714078d /src/vehicle_gui.cpp
parent74f9be8f2c1dca108b88449e6935c61442cbf829 (diff)
downloadopenttd-0f7392bd616e0bd256b5ec241ad52d7230bcc454.tar.xz
(svn r11822) -Codechange: Replaced fixed size custom name array. Names are now attached to their object directly and there is
no limit to the amount of names. -Fix: NewGRF engines could not be renamed.
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 5f35fa8dc..b0fb3b2dd 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -552,20 +552,14 @@ static int CDECL VehicleNameSorter(const void *a, const void *b)
if (va != last_vehicle[0]) {
last_vehicle[0] = va;
- if (IsCustomName(va->string_id)) {
- GetString(last_name[0], va->string_id, lastof(last_name[0]));
- } else {
- last_name[0][0] = '\0';
- }
+ SetDParam(0, va->index);
+ GetString(last_name[0], STR_VEHICLE_NAME, lastof(last_name[0]));
}
if (vb != last_vehicle[1]) {
last_vehicle[1] = vb;
- if (IsCustomName(vb->string_id)) {
- GetString(last_name[1], vb->string_id, lastof(last_name[1]));
- } else {
- last_name[1][0] = '\0';
- }
+ SetDParam(1, vb->index);
+ GetString(last_name[1], STR_VEHICLE_NAME, lastof(last_name[1]));
}
r = strcmp(last_name[0], last_name[1]); // sort by name
@@ -1010,11 +1004,7 @@ static void DrawVehicleListWindow(Window *w)
DrawVehicleImage(v, x + 19, y + 6, INVALID_VEHICLE, w->widget[VLW_WIDGET_LIST].right - w->widget[VLW_WIDGET_LIST].left - 20, 0);
DrawString(x + 19, y + w->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, TC_FROMSTRING);
- if ((v->type == VEH_TRAIN && v->string_id != STR_SV_TRAIN_NAME) ||
- (v->type == VEH_ROAD && v->string_id != STR_SV_ROADVEH_NAME) ||
- (v->type == VEH_SHIP && v->string_id != STR_SV_SHIP_NAME) ||
- (v->type == VEH_AIRCRAFT && v->string_id != STR_SV_AIRCRAFT_NAME)) {
-
+ if (v->name != NULL) {
/* The vehicle got a name so we will print it */
SetDParam(0, v->index);
DrawString(x + 19, y, STR_01AB, TC_FROMSTRING);