src/vehicle_gui.cpp
changeset 8754 5dae65402806
parent 8750 fdd6054e7bae
child 8760 ce0891c412ce
--- a/src/vehicle_gui.cpp	Sat Jan 12 19:33:25 2008 +0000
+++ b/src/vehicle_gui.cpp	Sat Jan 12 19:58:06 2008 +0000
@@ -552,20 +552,14 @@
 
 	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 @@
 		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);