diff src/vehicle_cmd.cpp @ 12483:84df0c285bc4 draft

(svn r16920) -Codechange: shuffle some strings around to simplify looking up vehicle type specific strings for a specific message
author rubidium <rubidium@openttd.org>
date Wed, 22 Jul 2009 20:17:07 +0000 (2009-07-22)
parents 37dff9994e71
children cf4a59021c9d
line wrap: on
line diff
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -93,27 +93,13 @@
 	}
 
 	if (flags & DC_EXEC) {
-		static const StringID vehicle_waiting_in_depot[] = {
-			STR_NEWS_TRAIN_IS_WAITING,
-			STR_NEWS_ROAD_VEHICLE_IS_WAITING,
-			STR_NEWS_SHIP_IS_WAITING,
-			STR_NEWS_AIRCRAFT_IS_WAITING,
-		};
-
-		static const WindowClass vehicle_list[] = {
-			WC_TRAINS_LIST,
-			WC_ROADVEH_LIST,
-			WC_SHIPS_LIST,
-			WC_AIRCRAFT_LIST,
-		};
-
-		if (v->IsStoppedInDepot() && (flags & DC_AUTOREPLACE) == 0) DeleteVehicleNews(p1, vehicle_waiting_in_depot[v->type]);
+		if (v->IsStoppedInDepot() && (flags & DC_AUTOREPLACE) == 0) DeleteVehicleNews(p1, STR_NEWS_TRAIN_IS_WAITING + v->type);
 
 		v->vehstatus ^= VS_STOPPED;
 		if (v->type != VEH_TRAIN) v->cur_speed = 0; // trains can stop 'slowly'
 		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
-		InvalidateWindowClasses(vehicle_list[v->type]);
+		InvalidateWindowClasses(GetWindowClassForVehicleType(v->type));
 	}
 	return CommandCost();
 }