src/depot_gui.cpp
changeset 9116 f2491d3c321b
parent 9111 48ce04029fe4
child 9127 14f21c5954ee
equal deleted inserted replaced
9115:47ae980bace3 9116:f2491d3c321b
   438 				TrainDepotMoveVehicle(v, sel, gdvp.head);
   438 				TrainDepotMoveVehicle(v, sel, gdvp.head);
   439 			} else if (v != NULL) {
   439 			} else if (v != NULL) {
   440 				int image = v->GetImage(DIR_W);
   440 				int image = v->GetImage(DIR_W);
   441 
   441 
   442 				WP(w, depot_d).sel = v->index;
   442 				WP(w, depot_d).sel = v->index;
   443 				SetWindowDirty(w);
   443 				w->SetDirty();
   444 				SetObjectToPlaceWnd(image, GetVehiclePalette(v), VHM_DRAG, w);
   444 				SetObjectToPlaceWnd(image, GetVehiclePalette(v), VHM_DRAG, w);
   445 				_cursor.vehchain = _ctrl_pressed;
   445 				_cursor.vehchain = _ctrl_pressed;
   446 			}
   446 			}
   447 			}
   447 			}
   448 			break;
   448 			break;
   901 				case DEPOT_WIDGET_MATRIX: {
   901 				case DEPOT_WIDGET_MATRIX: {
   902 					Vehicle *v;
   902 					Vehicle *v;
   903 					VehicleID sel = WP(w, depot_d).sel;
   903 					VehicleID sel = WP(w, depot_d).sel;
   904 
   904 
   905 					WP(w, depot_d).sel = INVALID_VEHICLE;
   905 					WP(w, depot_d).sel = INVALID_VEHICLE;
   906 					SetWindowDirty(w);
   906 					w->SetDirty();
   907 
   907 
   908 					if (WP(w, depot_d).type == VEH_TRAIN) {
   908 					if (WP(w, depot_d).type == VEH_TRAIN) {
   909 						GetDepotVehiclePtData gdvp;
   909 						GetDepotVehiclePtData gdvp;
   910 
   910 
   911 						if (GetVehicleFromDepotWndPt(w, e->we.dragdrop.pt.x, e->we.dragdrop.pt.y, &v, &gdvp) == MODE_DRAG_VEHICLE &&
   911 						if (GetVehicleFromDepotWndPt(w, e->we.dragdrop.pt.x, e->we.dragdrop.pt.y, &v, &gdvp) == MODE_DRAG_VEHICLE &&
   938 
   938 
   939 						w->HandleButtonClick(e->we.click.widget);
   939 						w->HandleButtonClick(e->we.click.widget);
   940 
   940 
   941 						v = GetVehicle(WP(w, depot_d).sel);
   941 						v = GetVehicle(WP(w, depot_d).sel);
   942 						WP(w, depot_d).sel = INVALID_VEHICLE;
   942 						WP(w, depot_d).sel = INVALID_VEHICLE;
   943 						SetWindowDirty(w);
   943 						w->SetDirty();
   944 
   944 
   945 						sell_cmd = (v->type == VEH_TRAIN && (e->we.click.widget == DEPOT_WIDGET_SELL_CHAIN || _ctrl_pressed)) ? 1 : 0;
   945 						sell_cmd = (v->type == VEH_TRAIN && (e->we.click.widget == DEPOT_WIDGET_SELL_CHAIN || _ctrl_pressed)) ? 1 : 0;
   946 
   946 
   947 						is_engine = (!(v->type == VEH_TRAIN && !IsFrontEngine(v)));
   947 						is_engine = (!(v->type == VEH_TRAIN && !IsFrontEngine(v)));
   948 
   948 
   962 						if (!DoCommandP(v->tile, v->index, sell_cmd, NULL, command) && is_engine) _backup_orders_tile = 0;
   962 						if (!DoCommandP(v->tile, v->index, sell_cmd, NULL, command) && is_engine) _backup_orders_tile = 0;
   963 					}
   963 					}
   964 					break;
   964 					break;
   965 				default:
   965 				default:
   966 					WP(w, depot_d).sel = INVALID_VEHICLE;
   966 					WP(w, depot_d).sel = INVALID_VEHICLE;
   967 					SetWindowDirty(w);
   967 					w->SetDirty();
   968 			}
   968 			}
   969 			_cursor.vehchain = false;
   969 			_cursor.vehchain = false;
   970 			break;
   970 			break;
   971 
   971 
   972 		case WE_RESIZE:
   972 		case WE_RESIZE: