src/depot_gui.cpp
changeset 7486 bf6a94009823
parent 7479 2bc7aacf47eb
child 7492 35acee076719
equal deleted inserted replaced
7485:d8799216928a 7486:bf6a94009823
   141 {
   141 {
   142 	if (!success) return;
   142 	if (!success) return;
   143 
   143 
   144 	Vehicle *v = GetVehicle(_new_vehicle_id);
   144 	Vehicle *v = GetVehicle(_new_vehicle_id);
   145 
   145 
   146 	switch (v->type) {
   146 	ShowVehicleViewWindow(v);
   147 		case VEH_TRAIN:    ShowTrainViewWindow(v);    break;
       
   148 		case VEH_ROAD:     ShowRoadVehViewWindow(v);  break;
       
   149 		case VEH_SHIP:     ShowShipViewWindow(v);     break;
       
   150 		case VEH_AIRCRAFT: ShowAircraftViewWindow(v); break;
       
   151 		default: NOT_REACHED();
       
   152 	}
       
   153 }
       
   154 
       
   155 static inline void ShowVehicleViewWindow(const Vehicle *v)
       
   156 {
       
   157 	switch (v->type) {
       
   158 		case VEH_TRAIN:    ShowTrainViewWindow(v);    break;
       
   159 		case VEH_ROAD:     ShowRoadVehViewWindow(v);  break;
       
   160 		case VEH_SHIP:     ShowShipViewWindow(v);     break;
       
   161 		case VEH_AIRCRAFT: ShowAircraftViewWindow(v); break;
       
   162 		default: NOT_REACHED();
       
   163 	}
       
   164 }
   147 }
   165 
   148 
   166 static void DepotSellAllConfirmationCallback(Window *w, bool confirmed)
   149 static void DepotSellAllConfirmationCallback(Window *w, bool confirmed)
   167 {
   150 {
   168 	if (confirmed) {
   151 	if (confirmed) {
   910 							if (gdvp.wagon != NULL && gdvp.wagon->index == sel && _ctrl_pressed) {
   893 							if (gdvp.wagon != NULL && gdvp.wagon->index == sel && _ctrl_pressed) {
   911 								DoCommandP(GetVehicle(sel)->tile, GetVehicle(sel)->index, true, NULL, CMD_REVERSE_TRAIN_DIRECTION | CMD_MSG(STR_9033_CAN_T_MAKE_VEHICLE_TURN));
   894 								DoCommandP(GetVehicle(sel)->tile, GetVehicle(sel)->index, true, NULL, CMD_REVERSE_TRAIN_DIRECTION | CMD_MSG(STR_9033_CAN_T_MAKE_VEHICLE_TURN));
   912 							} else if (gdvp.wagon == NULL || gdvp.wagon->index != sel) {
   895 							} else if (gdvp.wagon == NULL || gdvp.wagon->index != sel) {
   913 								TrainDepotMoveVehicle(gdvp.wagon, sel, gdvp.head);
   896 								TrainDepotMoveVehicle(gdvp.wagon, sel, gdvp.head);
   914 							} else if (gdvp.head != NULL && IsFrontEngine(gdvp.head)) {
   897 							} else if (gdvp.head != NULL && IsFrontEngine(gdvp.head)) {
   915 								ShowTrainViewWindow(gdvp.head);
   898 								ShowVehicleViewWindow(gdvp.head);
   916 							}
   899 							}
   917 						}
   900 						}
   918 					} else if (GetVehicleFromDepotWndPt(w, e->we.dragdrop.pt.x, e->we.dragdrop.pt.y, &v, NULL) == MODE_DRAG_VEHICLE &&
   901 					} else if (GetVehicleFromDepotWndPt(w, e->we.dragdrop.pt.x, e->we.dragdrop.pt.y, &v, NULL) == MODE_DRAG_VEHICLE &&
   919 						v != NULL &&
   902 						v != NULL &&
   920 						sel == v->index) {
   903 						sel == v->index) {