@ -570,14 +570,14 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if ( v - > type ! = VEH_AIRCRAFT | | ! CheckOwnership ( v - > owner ) | | v - > IsInDepot ( ) ) return CMD_ERROR ;
if ( v - > type ! = VEH_AIRCRAFT | | ! CheckOwnership ( v - > owner ) | | v - > IsInDepot ( ) ) return CMD_ERROR ;
if ( v - > current_order . IsType ( OT_GOTO_DEPOT ) & & ! ( p2 & DEPOT_LOCATE_HANGAR ) ) {
if ( v - > current_order . IsType ( OT_GOTO_DEPOT ) & & ! ( p2 & DEPOT_LOCATE_HANGAR ) ) {
bool halt_in_depot = HasBit( v- > current_order . GetDepotActionType ( ) , OF_HALT_IN_DEPOT ) ;
bool halt_in_depot = v- > current_order . GetDepotActionType ( ) & ODATFB_HALT ;
if ( ! ! ( p2 & DEPOT_SERVICE ) = = halt_in_depot ) {
if ( ! ! ( p2 & DEPOT_SERVICE ) = = halt_in_depot ) {
/* We called with a different DEPOT_SERVICE setting.
/* We called with a different DEPOT_SERVICE setting.
* Now we change the setting to apply the new one and let the vehicle head for the same hangar .
* Now we change the setting to apply the new one and let the vehicle head for the same hangar .
* Note : the if is ( true for requesting service = = true for ordered to stop in hangar ) */
* Note : the if is ( true for requesting service = = true for ordered to stop in hangar ) */
if ( flags & DC_EXEC ) {
if ( flags & DC_EXEC ) {
v - > current_order . SetDepotOrderType ( O FB _MANUAL_ORDER ) ;
v - > current_order . SetDepotOrderType ( O DT F_MANUAL) ;
v - > current_order . SetDepotActionType ( halt_in_depot ? O FB_NORMAL_ACTION : OFB_HALT_IN_DEPO T) ;
v - > current_order . SetDepotActionType ( halt_in_depot ? O DATF_SERVICE_ONLY : ODATFB_HAL T) ;
InvalidateWindowWidget ( WC_VEHICLE_VIEW , v - > index , VVW_WIDGET_START_STOP_VEH ) ;
InvalidateWindowWidget ( WC_VEHICLE_VIEW , v - > index , VVW_WIDGET_START_STOP_VEH ) ;
}
}
return CommandCost ( ) ;
return CommandCost ( ) ;
@ -587,7 +587,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if ( flags & DC_EXEC ) {
if ( flags & DC_EXEC ) {
/* If the orders to 'goto depot' are in the orders list (forced servicing),
/* If the orders to 'goto depot' are in the orders list (forced servicing),
* then skip to the next order ; effectively cancelling this forced service */
* then skip to the next order ; effectively cancelling this forced service */
if ( v - > current_order . GetDepotOrderType ( ) & O FB_PART_OF_ORDERS) v - > cur_order_index + + ;
if ( v - > current_order . GetDepotOrderType ( ) & O DT FB_PART_OF_ORDERS) v - > cur_order_index + + ;
v - > current_order . MakeDummy ( ) ;
v - > current_order . MakeDummy ( ) ;
InvalidateWindowWidget ( WC_VEHICLE_VIEW , v - > index , VVW_WIDGET_START_STOP_VEH ) ;
InvalidateWindowWidget ( WC_VEHICLE_VIEW , v - > index , VVW_WIDGET_START_STOP_VEH ) ;
@ -609,8 +609,8 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if ( flags & DC_EXEC ) {
if ( flags & DC_EXEC ) {
if ( v - > current_order . IsType ( OT_LOADING ) ) v - > LeaveStation ( ) ;
if ( v - > current_order . IsType ( OT_LOADING ) ) v - > LeaveStation ( ) ;
v - > current_order . MakeGoToDepot ( next_airport_index , false ) ;
v - > current_order . MakeGoToDepot ( next_airport_index , ODTF_MANUAL ) ;
if ( ! ( p2 & DEPOT_SERVICE ) ) v - > current_order . SetDepotActionType ( O FB_HALT_IN_DEPO T) ;
if ( ! ( p2 & DEPOT_SERVICE ) ) v - > current_order . SetDepotActionType ( O DAT FB_HALT) ;
InvalidateWindowWidget ( WC_VEHICLE_VIEW , v - > index , VVW_WIDGET_START_STOP_VEH ) ;
InvalidateWindowWidget ( WC_VEHICLE_VIEW , v - > index , VVW_WIDGET_START_STOP_VEH ) ;
if ( v - > u . air . state = = FLYING & & ! next_airport_has_hangar ) {
if ( v - > u . air . state = = FLYING & & ! next_airport_has_hangar ) {
/* The aircraft is now heading for a different hangar than the next in the orders */
/* The aircraft is now heading for a different hangar than the next in the orders */
@ -714,7 +714,7 @@ static void CheckIfAircraftNeedsService(Vehicle *v)
if ( st - > IsValid ( ) & & st - > airport_tile ! = 0 & & st - > Airport ( ) - > terminals ! = NULL ) {
if ( st - > IsValid ( ) & & st - > airport_tile ! = 0 & & st - > Airport ( ) - > terminals ! = NULL ) {
// printf("targetairport = %d, st->index = %d\n", v->u.air.targetairport, st->index);
// printf("targetairport = %d, st->index = %d\n", v->u.air.targetairport, st->index);
// v->u.air.targetairport = st->index;
// v->u.air.targetairport = st->index;
v - > current_order . MakeGoToDepot ( 0 , false ) ;
v - > current_order . MakeGoToDepot ( 0 , ODTFB_SERVICE ) ;
InvalidateWindowWidget ( WC_VEHICLE_VIEW , v - > index , VVW_WIDGET_START_STOP_VEH ) ;
InvalidateWindowWidget ( WC_VEHICLE_VIEW , v - > index , VVW_WIDGET_START_STOP_VEH ) ;
} else if ( v - > current_order . IsType ( OT_GOTO_DEPOT ) ) {
} else if ( v - > current_order . IsType ( OT_GOTO_DEPOT ) ) {
v - > current_order . MakeDummy ( ) ;
v - > current_order . MakeDummy ( ) ;