Departure: Store last used departure and via modes in client settings

This commit is contained in:
Jonathan G Rennison 2024-09-04 19:18:32 +01:00
parent 9771ec6b68
commit dc44a83cdb
3 changed files with 24 additions and 0 deletions

View File

@ -253,6 +253,10 @@ public:
this->show_via = true;
this->LowerWidget(WID_DB_SHOW_VIA);
} else {
this->mode = static_cast<DeparturesMode>(_settings_client.gui.departure_default_mode);
this->show_via = _settings_client.gui.departure_default_via;
this->SetWidgetLoweredState(WID_DB_SHOW_VIA, this->show_via);
}
this->RefreshVehicleList();
@ -361,6 +365,10 @@ public:
this->show_via = !this->show_via;
this->SetWidgetLoweredState(widget, this->show_via);
if (!this->is_waypoint) {
_settings_client.gui.departure_default_via = this->show_via;
}
/* We need to recompute the departures list. */
this->calc_tick_countdown = 0;
/* We need to redraw the button that was pressed. */
@ -450,6 +458,7 @@ public:
this->calc_tick_countdown = 0;
if (_pause_mode != PM_UNPAUSED) this->OnGameTick();
}
_settings_client.gui.departure_default_mode = this->mode;
this->SetWidgetDirty(widget);
break;
}

View File

@ -250,6 +250,8 @@ struct GUISettings : public TimeSettings {
uint8_t departure_conditionals; ///< how to handle conditional orders
bool departure_show_all_stops; ///< whether to show stops regardless of loading/unloading done at them
bool departure_merge_identical; ///< whether to merge identical departures
uint8_t departure_default_mode; ///< default mode for non-waypoint departure board window
bool departure_default_via; ///< default via type for non-waypoint departure board window
RightClickClose right_click_wnd_close; ///< close window with right click
bool pause_on_newgame; ///< whether to start new games paused or not
SignalGUISettings signal_gui_mode; ///< select which signal types are shown in the signal GUI

View File

@ -951,6 +951,19 @@ str = STR_CONFIG_DEPARTURE_MERGE_IDENTICAL
strhelp = STR_CONFIG_DEPARTURE_MERGE_IDENTICAL_HELPTEXT
post_cb = [](auto) { InvalidateWindowClassesData(WC_DEPARTURES_BOARD, 1); }
[SDTC_VAR]
var = gui.departure_default_mode
type = SLE_UINT8
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_PATCH
def = 0
min = 0
max = 3
[SDTC_BOOL]
var = gui.departure_default_via
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_PATCH
def = false
[SDTC_VAR]
var = gui.departure_conditionals
type = SLE_UINT8