From 402008d69edd75e86a9f25a69a3b7548109a9955 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 21 Nov 2009 12:45:00 +0000 Subject: (svn r18205) -Codechange: unduplicate some code --- src/timetable_gui.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src') 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; -- cgit v1.2.3-70-g09d2