diff options
author | rubidium <rubidium@openttd.org> | 2008-07-14 21:01:49 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-07-14 21:01:49 +0000 |
commit | 0f4d9a8e4928c8bd647734599b3eb8ec5720320a (patch) | |
tree | c04eab66f4437af132445671a76f32e893f6e47d /src/timetable_gui.cpp | |
parent | 797ccc8b49fb0bbc80d7598731ba45eb138d9d8d (diff) | |
download | openttd-0f4d9a8e4928c8bd647734599b3eb8ec5720320a.tar.xz |
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
Diffstat (limited to 'src/timetable_gui.cpp')
-rw-r--r-- | src/timetable_gui.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 14bb663ea..f39aed8ed 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -84,20 +84,19 @@ struct TimetableWindow : Window { SetVScrollCount(this, v->num_orders * 2); if (v->owner == _local_player) { - if (selected == -1) { - this->DisableWidget(TTV_CHANGE_TIME); - this->DisableWidget(TTV_CLEAR_TIME); - } else if (selected % 2 == 1) { - this->EnableWidget(TTV_CHANGE_TIME); - this->EnableWidget(TTV_CLEAR_TIME); - } else { + bool disable = true; + if (selected != -1) { const Order *order = GetVehicleOrder(v, (selected + 1) / 2); - bool disable = order == NULL || !order->IsType(OT_GOTO_STATION) || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION); - - this->SetWidgetDisabledState(TTV_CHANGE_TIME, disable); - this->SetWidgetDisabledState(TTV_CLEAR_TIME, disable); + if (selected % 2 == 1) { + disable = order != NULL && order->IsType(OT_CONDITIONAL); + } else { + disable = order == NULL || ((!order->IsType(OT_GOTO_STATION) || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) && !order->IsType(OT_CONDITIONAL)); + } } + this->SetWidgetDisabledState(TTV_CHANGE_TIME, disable); + this->SetWidgetDisabledState(TTV_CLEAR_TIME, disable); + this->EnableWidget(TTV_RESET_LATENESS); this->EnableWidget(TTV_AUTOFILL); } else { @@ -137,7 +136,9 @@ struct TimetableWindow : Window { } else { StringID string; - if (order->travel_time == 0) { + if (order->IsType(OT_CONDITIONAL)) { + string = STR_TIMETABLE_NO_TRAVEL; + } else if (order->travel_time == 0) { string = STR_TIMETABLE_TRAVEL_NOT_TIMETABLED; } else { SetTimetableParams(0, 1, order->travel_time); @@ -161,7 +162,7 @@ struct TimetableWindow : Window { for (const Order *order = GetVehicleOrder(v, 0); order != NULL; order = order->next) { total_time += order->travel_time + order->wait_time; - if (order->travel_time == 0) complete = false; + if (order->travel_time == 0 && !order->IsType(OT_CONDITIONAL)) complete = false; if (order->wait_time == 0 && order->IsType(OT_GOTO_STATION) && !(order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) complete = false; } |