train_gui.c
changeset 10 c35ab8426202
parent 0 29654efe3188
child 22 fe6f35cc987b
equal deleted inserted replaced
9:b1ecf90eb6da 10:c35ab8426202
   440 	GetDepotVehiclePtData gdvp;
   440 	GetDepotVehiclePtData gdvp;
   441 	int mode, sel;
   441 	int mode, sel;
   442 	Vehicle *v;
   442 	Vehicle *v;
   443 
   443 
   444 	mode = GetVehicleFromTrainDepotWndPt(w, x, y, &gdvp);
   444 	mode = GetVehicleFromTrainDepotWndPt(w, x, y, &gdvp);
   445 	
   445 
       
   446 	// share / copy orders
   446 	if (_thd.place_mode && mode <= 0) { _place_clicked_vehicle = gdvp.head; return; }
   447 	if (_thd.place_mode && mode <= 0) { _place_clicked_vehicle = gdvp.head; return; }
   447 	
   448 	
   448 	v = gdvp.wagon;
   449 	v = gdvp.wagon;
   449 
   450 
   450 	switch(mode) {
   451 	switch(mode) {
   451 	case 0:
   452 	case 0: // start dragging of vehicle
   452 		sel = (int16)WP(w,traindepot_d).sel;
   453 		sel = (int16)WP(w,traindepot_d).sel;
   453 		if (sel != -1) {
   454 		if (sel != -1) {
   454 			WP(w,traindepot_d).sel = INVALID_VEHICLE;
   455 			WP(w,traindepot_d).sel = INVALID_VEHICLE;
   455 			TrainDepotMoveVehicle(v, sel, gdvp.head);
   456 			TrainDepotMoveVehicle(v, sel, gdvp.head);
   456 		} else if (v != NULL) {
   457 		} else if (v != NULL) {
   458 			SetObjectToPlaceWnd( SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)) + GetTrainImage(v, 6), 4, w);
   459 			SetObjectToPlaceWnd( SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)) + GetTrainImage(v, 6), 4, w);
   459 			SetWindowDirty(w);
   460 			SetWindowDirty(w);
   460 		}
   461 		}
   461 		break;
   462 		break;
   462 
   463 
   463 	case -1:
   464 	case -1: // show info window
   464 		ShowTrainViewWindow(v);
   465 		ShowTrainViewWindow(v);
   465 		break;
   466 		break;
   466 
   467 
   467 	case -2:
   468 	case -2: // click start/stop flag
   468 		DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_TRAIN | CMD_MSG(STR_883B_CAN_T_STOP_START_TRAIN));
   469 		DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_TRAIN | CMD_MSG(STR_883B_CAN_T_STOP_START_TRAIN));
   469 		break;
   470 		break;
   470 	}
   471 	}
   471 }
   472 }
   472 
   473