diff options
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r-- | src/vehicle_gui.cpp | 20 |
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); |