@ -389,6 +389,7 @@ struct TimetableWindow : Window {
this - > EnableWidget ( WID_VT_ADD_VEH_GROUP ) ;
this - > SetWidgetDisabledState ( WID_VT_LOCK_ORDER_TIME , ! wait_lockable ) ;
this - > SetWidgetLoweredState ( WID_VT_LOCK_ORDER_TIME , wait_locked ) ;
this - > SetWidgetDisabledState ( WID_VT_EXTRA , disable | | ( selected % 2 ! = 0 ) ) ;
} else {
this - > DisableWidget ( WID_VT_START_DATE ) ;
this - > DisableWidget ( WID_VT_CHANGE_TIME ) ;
@ -402,6 +403,7 @@ struct TimetableWindow : Window {
this - > DisableWidget ( WID_VT_SHARED_ORDER_LIST ) ;
this - > DisableWidget ( WID_VT_ADD_VEH_GROUP ) ;
this - > DisableWidget ( WID_VT_LOCK_ORDER_TIME ) ;
this - > DisableWidget ( WID_VT_EXTRA ) ;
}
this - > SetWidgetLoweredState ( WID_VT_AUTOFILL , HasBit ( v - > vehicle_flags , VF_AUTOFILL_TIMETABLE ) ) ;
@ -673,7 +675,7 @@ struct TimetableWindow : Window {
if ( order_number > = v - > GetNumOrders ( ) ) order_number = 0 ;
return v - > index | ( order_number < < 20 ) | ( mtf < < 28 ) | ( clear ? 1 < < 3 0 : 0 ) ;
return v - > index | ( order_number < < 20 ) | ( mtf < < 28 ) | ( clear ? 1 < < 3 1 : 0 ) ;
}
virtual void OnClick ( Point pt , int widget , int click_count )
@ -840,11 +842,41 @@ struct TimetableWindow : Window {
ShowQueryString ( STR_EMPTY , STR_GROUP_RENAME_CAPTION , MAX_LENGTH_GROUP_NAME_CHARS , this , CS_ALPHANUMERAL , QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS ) ;
break ;
}
case WID_VT_EXTRA : {
VehicleOrderID real = ( this - > sel_index + 1 ) / 2 ;
if ( real > = this - > vehicle - > GetNumOrders ( ) ) real = 0 ;
const Order * order = this - > vehicle - > GetOrder ( real ) ;
bool leave_type_disabled = ( order = = NULL ) | |
( ( ! ( order - > IsType ( OT_GOTO_STATION ) | | ( order - > IsType ( OT_GOTO_DEPOT ) & & ! ( order - > GetDepotActionType ( ) & ODATFB_HALT ) ) ) | |
( order - > GetNonStopType ( ) & ONSF_NO_STOP_AT_DESTINATION_STATION ) ) & & ! order - > IsType ( OT_CONDITIONAL ) ) ;
DropDownList * list = new DropDownList ( ) ;
* list - > Append ( ) = new DropDownListStringItem ( STR_TIMETABLE_LEAVE_NORMAL , OLT_NORMAL , leave_type_disabled ) ;
* list - > Append ( ) = new DropDownListStringItem ( STR_TIMETABLE_LEAVE_EARLY , OLT_LEAVE_EARLY , leave_type_disabled ) ;
ShowDropDownList ( this , list , order ! = NULL ? order - > GetLeaveType ( ) : - 1 , WID_VT_EXTRA ) ;
break ;
}
}
this - > SetDirty ( ) ;
}
virtual void OnDropdownSelect ( int widget , int index ) OVERRIDE
{
switch ( widget ) {
case WID_VT_EXTRA : {
VehicleOrderID order_number = ( this - > sel_index + 1 ) / 2 ;
if ( order_number > = this - > vehicle - > GetNumOrders ( ) ) order_number = 0 ;
uint32 p1 = this - > vehicle - > index | ( order_number < < 20 ) | ( MTF_SET_LEAVE_TYPE < < 28 ) ;
DoCommandP ( 0 , p1 , index , CMD_CHANGE_TIMETABLE | CMD_MSG ( STR_ERROR_CAN_T_TIMETABLE_VEHICLE ) ) ;
}
default :
break ;
}
}
virtual void OnQueryTextFinished ( char * str )
{
if ( str = = NULL ) return ;
@ -963,12 +995,13 @@ static const NWidgetPart _nested_timetable_widgets[] = {
NWidget ( WWT_PUSHTXTBTN , COLOUR_GREY , WID_VT_CLEAR_SPEED ) , SetResize ( 1 , 0 ) , SetFill ( 1 , 1 ) , SetDataTip ( STR_TIMETABLE_CLEAR_SPEED , STR_TIMETABLE_CLEAR_SPEED_TOOLTIP ) ,
EndContainer ( ) ,
NWidget ( NWID_VERTICAL , NC_EQUALSIZE ) ,
NWidget ( WWT_PUSHTXTBTN , COLOUR_GREY , WID_VT_ SCHEDULED_DISPATCH ) , SetResize ( 1 , 0 ) , SetFill ( 1 , 1 ) , SetDataTip ( STR_TIMETABLE_ SCHEDULED_DISPATCH, STR_TIMETABLE_SCHEDULED_DISPATCH _TOOLTIP) ,
NWidget ( WWT_PUSHTXTBTN , COLOUR_GREY , WID_VT_ AUTOMATE ) , SetResize ( 1 , 0 ) , SetFill ( 1 , 1 ) , SetDataTip ( STR_TIMETABLE_ AUTOMATE, STR_TIMETABLE_AUTOMATE _TOOLTIP) ,
NWidget ( WWT_PUSHTXTBTN , COLOUR_GREY , WID_VT_AUTO_SEPARATION ) , SetResize ( 1 , 0 ) , SetFill ( 1 , 1 ) , SetDataTip ( STR_TIMETABLE_AUTO_SEPARATION , STR_TIMETABLE_AUTO_SEPARATION_TOOLTIP ) ,
NWidget ( WWT_ PUSHTXTBTN, COLOUR_GREY , WID_VT_RESET_LATENESS ) , SetResize ( 1 , 0 ) , SetFill ( 1 , 1 ) , SetDataTip ( STR_TIMETABLE_ RESET_LATENESS, STR_TIMETABLE_RESET_LATENESS _TOOLTIP) ,
NWidget ( WWT_ DROPDOWN, COLOUR_GREY , WID_VT_EXTRA ) , SetResize ( 1 , 0 ) , SetFill ( 1 , 1 ) , SetDataTip ( STR_TIMETABLE_ EXTRA_DROP_DOWN, STR_TIMETABLE_EXTRA_DROP_DOWN _TOOLTIP) ,
EndContainer ( ) ,
NWidget ( NWID_VERTICAL , NC_EQUALSIZE ) ,
NWidget ( WWT_PUSHTXTBTN , COLOUR_GREY , WID_VT_AUTOMATE ) , SetResize ( 1 , 0 ) , SetFill ( 1 , 1 ) , SetDataTip ( STR_TIMETABLE_AUTOMATE , STR_TIMETABLE_AUTOMATE_TOOLTIP ) ,
NWidget ( WWT_PUSHTXTBTN , COLOUR_GREY , WID_VT_SCHEDULED_DISPATCH ) , SetResize ( 1 , 0 ) , SetFill ( 1 , 1 ) , SetDataTip ( STR_TIMETABLE_SCHEDULED_DISPATCH , STR_TIMETABLE_SCHEDULED_DISPATCH_TOOLTIP ) ,
NWidget ( WWT_PUSHTXTBTN , COLOUR_GREY , WID_VT_RESET_LATENESS ) , SetResize ( 1 , 0 ) , SetFill ( 1 , 1 ) , SetDataTip ( STR_TIMETABLE_RESET_LATENESS , STR_TIMETABLE_RESET_LATENESS_TOOLTIP ) ,
NWidget ( NWID_SELECTION , INVALID_COLOUR , WID_VT_EXPECTED_SELECTION ) ,
NWidget ( WWT_PUSHTXTBTN , COLOUR_GREY , WID_VT_EXPECTED ) , SetResize ( 1 , 0 ) , SetFill ( 1 , 1 ) , SetDataTip ( STR_BLACK_STRING , STR_TIMETABLE_EXPECTED_TOOLTIP ) ,
NWidget ( WWT_PANEL , COLOUR_GREY ) , SetResize ( 1 , 0 ) , SetFill ( 1 , 1 ) , EndContainer ( ) ,