mirror of https://github.com/OpenTTD/OpenTTD
Change: When using wallclock timekeeping, force timetable display to seconds
parent
0b4311bf13
commit
ef63c04599
|
@ -503,4 +503,14 @@ static void ChangeTimekeepingUnits(int32_t)
|
|||
InvalidateWindowClassesData(WC_GAME_OPTIONS, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-callback check when trying to change the timetable mode. This is locked to Seconds when using wallclock units.
|
||||
* @param Unused.
|
||||
* @return True if we allow changing the timetable mode.
|
||||
*/
|
||||
static bool CanChangeTimetableMode(int32_t &)
|
||||
{
|
||||
return !TimerGameEconomy::UsingWallclockUnits();
|
||||
}
|
||||
|
||||
/* End - Callback Functions */
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
; GUI settings as stored in the main configuration file ("openttd.cfg").
|
||||
|
||||
[pre-amble]
|
||||
static bool CanChangeTimetableMode(int32_t &new_value);
|
||||
static void v_PositionMainToolbar(int32_t new_value);
|
||||
static void v_PositionStatusbar(int32_t new_value);
|
||||
static void RedrawSmallmap(int32_t new_value);
|
||||
|
@ -430,6 +431,7 @@ max = 2
|
|||
str = STR_CONFIG_SETTING_TIMETABLE_MODE
|
||||
strhelp = STR_CONFIG_SETTING_TIMETABLE_MODE_HELPTEXT
|
||||
strval = STR_CONFIG_SETTING_TIMETABLE_MODE_DAYS
|
||||
pre_cb = CanChangeTimetableMode
|
||||
post_cb = [](auto) { InvalidateWindowClassesData(WC_VEHICLE_TIMETABLE, VIWD_MODIFY_ORDERS); }
|
||||
cat = SC_ADVANCED
|
||||
|
||||
|
|
|
@ -215,6 +215,12 @@ struct TimetableWindow : Window {
|
|||
{
|
||||
this->CreateNestedTree();
|
||||
this->vscroll = this->GetScrollbar(WID_VT_SCROLLBAR);
|
||||
|
||||
/* When using wallclock units, we must ensure the client displays timetables in seconds. */
|
||||
if (TimerGameEconomy::UsingWallclockUnits()) {
|
||||
_settings_client.gui.timetable_mode = TimetableMode::Seconds;
|
||||
}
|
||||
|
||||
this->UpdateSelectionStates();
|
||||
this->FinishInitNested(window_number);
|
||||
|
||||
|
|
Loading…
Reference in New Issue