comparison 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
parents 37dff9994e71
children cf4a59021c9d
comparison
equal deleted inserted replaced
12482:37dff9994e71 12483:84df0c285bc4
91 StringID error = GetGRFStringID(GetEngineGRFID(v->engine_type), 0xD000 + callback); 91 StringID error = GetGRFStringID(GetEngineGRFID(v->engine_type), 0xD000 + callback);
92 return_cmd_error(error); 92 return_cmd_error(error);
93 } 93 }
94 94
95 if (flags & DC_EXEC) { 95 if (flags & DC_EXEC) {
96 static const StringID vehicle_waiting_in_depot[] = { 96 if (v->IsStoppedInDepot() && (flags & DC_AUTOREPLACE) == 0) DeleteVehicleNews(p1, STR_NEWS_TRAIN_IS_WAITING + v->type);
97 STR_NEWS_TRAIN_IS_WAITING,
98 STR_NEWS_ROAD_VEHICLE_IS_WAITING,
99 STR_NEWS_SHIP_IS_WAITING,
100 STR_NEWS_AIRCRAFT_IS_WAITING,
101 };
102
103 static const WindowClass vehicle_list[] = {
104 WC_TRAINS_LIST,
105 WC_ROADVEH_LIST,
106 WC_SHIPS_LIST,
107 WC_AIRCRAFT_LIST,
108 };
109
110 if (v->IsStoppedInDepot() && (flags & DC_AUTOREPLACE) == 0) DeleteVehicleNews(p1, vehicle_waiting_in_depot[v->type]);
111 97
112 v->vehstatus ^= VS_STOPPED; 98 v->vehstatus ^= VS_STOPPED;
113 if (v->type != VEH_TRAIN) v->cur_speed = 0; // trains can stop 'slowly' 99 if (v->type != VEH_TRAIN) v->cur_speed = 0; // trains can stop 'slowly'
114 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); 100 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
115 InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); 101 InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
116 InvalidateWindowClasses(vehicle_list[v->type]); 102 InvalidateWindowClasses(GetWindowClassForVehicleType(v->type));
117 } 103 }
118 return CommandCost(); 104 return CommandCost();
119 } 105 }
120 106
121 /** Starts or stops a lot of vehicles 107 /** Starts or stops a lot of vehicles