1
0
Fork 0

Change: When using wallclock timekeeping, force timetable display to seconds

pull/11341/head
Tyler Trahan 2023-12-12 10:07:36 -05:00
parent 0b4311bf13
commit ef63c04599
3 changed files with 18 additions and 0 deletions

View File

@ -503,4 +503,14 @@ static void ChangeTimekeepingUnits(int32_t)
InvalidateWindowClassesData(WC_GAME_OPTIONS, 0); 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 */ /* End - Callback Functions */

View File

@ -7,6 +7,7 @@
; GUI settings as stored in the main configuration file ("openttd.cfg"). ; GUI settings as stored in the main configuration file ("openttd.cfg").
[pre-amble] [pre-amble]
static bool CanChangeTimetableMode(int32_t &new_value);
static void v_PositionMainToolbar(int32_t new_value); static void v_PositionMainToolbar(int32_t new_value);
static void v_PositionStatusbar(int32_t new_value); static void v_PositionStatusbar(int32_t new_value);
static void RedrawSmallmap(int32_t new_value); static void RedrawSmallmap(int32_t new_value);
@ -430,6 +431,7 @@ max = 2
str = STR_CONFIG_SETTING_TIMETABLE_MODE str = STR_CONFIG_SETTING_TIMETABLE_MODE
strhelp = STR_CONFIG_SETTING_TIMETABLE_MODE_HELPTEXT strhelp = STR_CONFIG_SETTING_TIMETABLE_MODE_HELPTEXT
strval = STR_CONFIG_SETTING_TIMETABLE_MODE_DAYS strval = STR_CONFIG_SETTING_TIMETABLE_MODE_DAYS
pre_cb = CanChangeTimetableMode
post_cb = [](auto) { InvalidateWindowClassesData(WC_VEHICLE_TIMETABLE, VIWD_MODIFY_ORDERS); } post_cb = [](auto) { InvalidateWindowClassesData(WC_VEHICLE_TIMETABLE, VIWD_MODIFY_ORDERS); }
cat = SC_ADVANCED cat = SC_ADVANCED

View File

@ -215,6 +215,12 @@ struct TimetableWindow : Window {
{ {
this->CreateNestedTree(); this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_VT_SCROLLBAR); 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->UpdateSelectionStates();
this->FinishInitNested(window_number); this->FinishInitNested(window_number);