MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / VehicleIsAboveLatenessThreshold

Function VehicleIsAboveLatenessThreshold

src/timetable_gui.cpp:85–97  ·  view source on GitHub ↗

* Determine if a vehicle should be shown as late or early, using a threshold depending on the timetable display setting. * @param ticks The number of ticks that the vehicle is late or early. * @param round_to_day When using ticks, if we should round up to the nearest day. * @return True if the vehicle is outside the "on time" threshold, either early or late. */

Source from the content-addressed store, hash-verified

83 * @return True if the vehicle is outside the "on time" threshold, either early or late.
84 */
85bool VehicleIsAboveLatenessThreshold(TimerGameTick::Ticks ticks, bool round_to_day)
86{
87 switch (_settings_client.gui.timetable_mode) {
88 case TimetableMode::Days:
89 return ticks > Ticks::DAY_TICKS;
90 case TimetableMode::Seconds:
91 return ticks > Ticks::TICKS_PER_SECOND;
92 case TimetableMode::Ticks:
93 return ticks > (round_to_day ? Ticks::DAY_TICKS : 0);
94 default:
95 NOT_REACHED();
96 }
97}
98
99/**
100 * Check whether it is possible to determine how long the order takes.

Callers 2

DrawSummaryPanelMethod · 0.85

Calls 1

NOT_REACHEDFunction · 0.85

Tested by

no test coverage detected