@ -90,7 +90,7 @@ static void SetArrivalDepartParams(int param1, int param2, Ticks ticks)
static bool CanDetermineTimeTaken ( const Order * order , bool travelling )
static bool CanDetermineTimeTaken ( const Order * order , bool travelling )
{
{
/* Current order is conditional */
/* Current order is conditional */
if ( order - > IsType ( OT_CONDITIONAL ) ) return false ;
if ( order - > IsType ( OT_CONDITIONAL ) | | order - > IsType ( OT_AUTOMATIC ) ) return false ;
/* No travel time and we have not already finished travelling */
/* No travel time and we have not already finished travelling */
if ( travelling & & order - > travel_time = = 0 ) return false ;
if ( travelling & & order - > travel_time = = 0 ) return false ;
/* No wait time but we are loading at this timetabled station */
/* No wait time but we are loading at this timetabled station */
@ -126,15 +126,20 @@ static void FillTimetableArrivalDepartureTable(const Vehicle *v, VehicleOrderID
/* Cyclically loop over all orders until we reach the current one again.
/* Cyclically loop over all orders until we reach the current one again.
* As we may start at the current order , do a post - checking loop */
* As we may start at the current order , do a post - checking loop */
do {
do {
if ( travelling | | i ! = start ) {
/* Automatic orders don't influence the overall timetable;
if ( ! CanDetermineTimeTaken ( order , true ) ) return ;
* they just add some untimetabled entries , but the time till
sum + = order - > travel_time ;
* the next non - automatic order can still be known . */
table [ i ] . arrival = sum ;
if ( ! order - > IsType ( OT_AUTOMATIC ) ) {
}
if ( travelling | | i ! = start ) {
if ( ! CanDetermineTimeTaken ( order , true ) ) return ;
sum + = order - > travel_time ;
table [ i ] . arrival = sum ;
}
if ( ! CanDetermineTimeTaken ( order , false ) ) return ;
if ( ! CanDetermineTimeTaken ( order , false ) ) return ;
sum + = order - > wait_time ;
sum + = order - > wait_time ;
table [ i ] . departure = sum ;
table [ i ] . departure = sum ;
}
+ + i ;
+ + i ;
order = order - > next ;
order = order - > next ;
@ -317,7 +322,7 @@ struct TimetableWindow : Window {
if ( selected ! = - 1 ) {
if ( selected ! = - 1 ) {
const Order * order = v - > GetOrder ( ( ( selected + 1 ) / 2 ) % v - > GetNumOrders ( ) ) ;
const Order * order = v - > GetOrder ( ( ( selected + 1 ) / 2 ) % v - > GetNumOrders ( ) ) ;
if ( selected % 2 = = 1 ) {
if ( selected % 2 = = 1 ) {
disable = order ! = NULL & & order - > IsType ( OT_CONDITIONAL ) ;
disable = order ! = NULL & & ( order - > IsType ( OT_CONDITIONAL ) | | order - > IsType ( OT_AUTOMATIC ) ) ;
} else {
} else {
disable = order = = NULL | | ( ( ! order - > IsType ( OT_GOTO_STATION ) | | ( order - > GetNonStopType ( ) & ONSF_NO_STOP_AT_DESTINATION_STATION ) ) & & ! order - > IsType ( OT_CONDITIONAL ) ) ;
disable = order = = NULL | | ( ( ! order - > IsType ( OT_GOTO_STATION ) | | ( order - > GetNonStopType ( ) & ONSF_NO_STOP_AT_DESTINATION_STATION ) ) & & ! order - > IsType ( OT_CONDITIONAL ) ) ;
}
}
@ -387,9 +392,12 @@ struct TimetableWindow : Window {
}
}
} else {
} else {
StringID string ;
StringID string ;
TextColour colour = ( i = = selected ) ? TC_WHITE : TC_BLACK ;
if ( order - > IsType ( OT_CONDITIONAL ) ) {
if ( order - > IsType ( OT_CONDITIONAL ) ) {
string = STR_TIMETABLE_NO_TRAVEL ;
string = STR_TIMETABLE_NO_TRAVEL ;
} else if ( order - > IsType ( OT_AUTOMATIC ) ) {
string = STR_TIMETABLE_NOT_TIMETABLEABLE ;
colour = ( ( i = = selected ) ? TC_SILVER : TC_GREY ) | TC_NO_SHADE ;
} else if ( order - > travel_time = = 0 ) {
} else if ( order - > travel_time = = 0 ) {
string = STR_TIMETABLE_TRAVEL_NOT_TIMETABLED ;
string = STR_TIMETABLE_TRAVEL_NOT_TIMETABLED ;
} else {
} else {
@ -397,7 +405,7 @@ struct TimetableWindow : Window {
string = STR_TIMETABLE_TRAVEL_FOR ;
string = STR_TIMETABLE_TRAVEL_FOR ;
}
}
DrawString ( rtl ? r . left + WD_FRAMERECT_LEFT : middle , rtl ? middle : r . right - WD_FRAMERECT_LEFT , y , string , ( i = = selected ) ? TC_WHITE : TC_BLACK ) ;
DrawString ( rtl ? r . left + WD_FRAMERECT_LEFT : middle , rtl ? middle : r . right - WD_FRAMERECT_LEFT , y , string , colour ) ;
if ( final_order ) break ;
if ( final_order ) break ;
}
}