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

Function ResetSignalVariant

src/rail_gui.cpp:1990–2002  ·  view source on GitHub ↗

* Updates the current signal variant used in the signal GUI * to the one adequate to current year. */

Source from the content-addressed store, hash-verified

1988 * to the one adequate to current year.
1989 */
1990void ResetSignalVariant(int32_t)
1991{
1992 SignalVariant new_variant = (TimerGameCalendar::year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
1993
1994 if (new_variant != _cur_signal_variant) {
1995 Window *w = FindWindowById(WC_BUILD_SIGNAL, 0);
1996 if (w != nullptr) {
1997 w->SetDirty();
1998 w->RaiseWidget((_cur_signal_variant == SIG_ELECTRIC ? WID_BS_ELECTRIC_NORM : WID_BS_SEMAPHORE_NORM) + _cur_signal_type);
1999 }
2000 _cur_signal_variant = new_variant;
2001 }
2002}
2003
2004static const IntervalTimer<TimerGameCalendar> _check_reset_signal({TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [](auto)
2005{

Callers 3

ClickChangeDateCheatFunction · 0.85
rail_gui.cppFile · 0.85
InitializeRailGUIFunction · 0.85

Calls 3

FindWindowByIdFunction · 0.85
RaiseWidgetMethod · 0.80
SetDirtyMethod · 0.45

Tested by

no test coverage detected