mirror of https://github.com/OpenTTD/OpenTTD
(svn r26639) -Codechange: Simplify drawing early/late dates in timetable GUI.
parent
26b61a4aeb
commit
4d2107bd61
|
@ -55,18 +55,6 @@ void SetTimetableParams(int param1, int param2, Ticks ticks)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the arrival or departure string and parameters.
|
|
||||||
* @param param1 the first DParam to fill
|
|
||||||
* @param param2 the second DParam to fill
|
|
||||||
* @param ticks the number of ticks to 'draw'
|
|
||||||
*/
|
|
||||||
static void SetArrivalDepartParams(int param1, int param2, Ticks ticks)
|
|
||||||
{
|
|
||||||
SetDParam(param1, STR_JUST_DATE_TINY);
|
|
||||||
SetDParam(param2, _date + (ticks / DAY_TICKS));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether it is possible to determine how long the order takes.
|
* Check whether it is possible to determine how long the order takes.
|
||||||
* @param order the order to check.
|
* @param order the order to check.
|
||||||
|
@ -462,18 +450,20 @@ struct TimetableWindow : Window {
|
||||||
if (arr_dep[i / 2].arrival != INVALID_TICKS) {
|
if (arr_dep[i / 2].arrival != INVALID_TICKS) {
|
||||||
DrawString(abbr_left, abbr_right, y, STR_TIMETABLE_ARRIVAL_ABBREVIATION, i == selected ? TC_WHITE : TC_BLACK);
|
DrawString(abbr_left, abbr_right, y, STR_TIMETABLE_ARRIVAL_ABBREVIATION, i == selected ? TC_WHITE : TC_BLACK);
|
||||||
if (this->show_expected && i / 2 == earlyID) {
|
if (this->show_expected && i / 2 == earlyID) {
|
||||||
SetArrivalDepartParams(0, 1, arr_dep[i / 2].arrival);
|
SetDParam(0, _date + arr_dep[i / 2].arrival / DAY_TICKS);
|
||||||
DrawString(time_left, time_right, y, STR_GREEN_STRING, i == selected ? TC_WHITE : TC_BLACK);
|
DrawString(time_left, time_right, y, STR_JUST_DATE_TINY, TC_GREEN);
|
||||||
} else {
|
} else {
|
||||||
SetArrivalDepartParams(0, 1, arr_dep[i / 2].arrival + offset);
|
SetDParam(0, _date + (arr_dep[i / 2].arrival + offset) / DAY_TICKS);
|
||||||
DrawString(time_left, time_right, y, show_late ? STR_RED_STRING : STR_JUST_STRING, i == selected ? TC_WHITE : TC_BLACK);
|
DrawString(time_left, time_right, y, STR_JUST_DATE_TINY,
|
||||||
|
show_late ? TC_RED : i == selected ? TC_WHITE : TC_BLACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (arr_dep[i / 2].departure != INVALID_TICKS) {
|
if (arr_dep[i / 2].departure != INVALID_TICKS) {
|
||||||
DrawString(abbr_left, abbr_right, y, STR_TIMETABLE_DEPARTURE_ABBREVIATION, i == selected ? TC_WHITE : TC_BLACK);
|
DrawString(abbr_left, abbr_right, y, STR_TIMETABLE_DEPARTURE_ABBREVIATION, i == selected ? TC_WHITE : TC_BLACK);
|
||||||
SetArrivalDepartParams(0, 1, arr_dep[i/2].departure + offset);
|
SetDParam(0, _date + (arr_dep[i/2].departure + offset) / DAY_TICKS);
|
||||||
DrawString(time_left, time_right, y, show_late ? STR_RED_STRING : STR_JUST_STRING, i == selected ? TC_WHITE : TC_BLACK);
|
DrawString(time_left, time_right, y, STR_JUST_DATE_TINY,
|
||||||
|
show_late ? TC_RED : i == selected ? TC_WHITE : TC_BLACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
y += FONT_HEIGHT_NORMAL;
|
y += FONT_HEIGHT_NORMAL;
|
||||||
|
|
Loading…
Reference in New Issue