summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-11-21 12:45:00 +0000
committerrubidium <rubidium@openttd.org>2009-11-21 12:45:00 +0000
commit402008d69edd75e86a9f25a69a3b7548109a9955 (patch)
treed6b58cda63ef7967ded9a0afd0efef420be10f93 /src
parent37056b564ce6d05e221a7dae9f67917eef227795 (diff)
downloadopenttd-402008d69edd75e86a9f25a69a3b7548109a9955.tar.xz
(svn r18205) -Codechange: unduplicate some code
Diffstat (limited to 'src')
-rw-r--r--src/timetable_gui.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index 2962f47b0..348bd0f0d 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -248,17 +248,10 @@ struct TimetableWindow : Window {
case TTV_SUMMARY_PANEL: {
int y = r.top + WD_FRAMERECT_TOP;
- uint total_time = 0;
- bool complete = true;
- for (const Order *order = v->GetOrder(0); order != NULL; order = order->next) {
- total_time += order->travel_time + order->wait_time;
- 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;
- }
-
+ Ticks total_time = v->orders.list != NULL ? v->orders.list->GetTimetableDurationIncomplete() : 0;
if (total_time != 0) {
SetTimetableParams(0, 1, total_time);
- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, complete ? STR_TIMETABLE_TOTAL_TIME : STR_TIMETABLE_TOTAL_TIME_INCOMPLETE);
+ DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, v->orders.list->IsCompleteTimetable() ? STR_TIMETABLE_TOTAL_TIME : STR_TIMETABLE_TOTAL_TIME_INCOMPLETE);
}
y += FONT_HEIGHT_NORMAL;