From 5a1fa185094dbcb563ba2b4ed5530995be374b19 Mon Sep 17 00:00:00 2001 From: frosch Date: Tue, 12 Jan 2021 23:07:44 +0100 Subject: Change: move the 'road drive side' selection to settings tree, and give it the same 'basic' visibilty as 'signal side'. --- src/lang/english.txt | 2 -- src/settings_gui.cpp | 37 ------------------------------------- src/table/settings.ini | 1 + src/widgets/settings_widget.h | 1 - 4 files changed, 1 insertion(+), 40 deletions(-) diff --git a/src/lang/english.txt b/src/lang/english.txt index d92c5ec8f..bf188651c 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -948,8 +948,6 @@ STR_GAME_OPTIONS_CURRENCY_HKD :Hong Kong Dolla STR_GAME_OPTIONS_CURRENCY_INR :Indian Rupee (INR) ############ end of currency region -STR_GAME_OPTIONS_ROAD_VEHICLES_FRAME :{BLACK}Road vehicles -STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_TOOLTIP :{BLACK}Select side of road for vehicles to drive on STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_LEFT :Drive on left STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_RIGHT :Drive on right diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 34f21308f..d2a22dff4 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -41,12 +41,6 @@ #include "safeguards.h" -static const StringID _driveside_dropdown[] = { - STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_LEFT, - STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_RIGHT, - INVALID_STRING_ID -}; - static const StringID _autosave_dropdown[] = { STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_OFF, STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_1_MONTH, @@ -193,24 +187,6 @@ struct GameOptionsWindow : Window { break; } - case WID_GO_ROADSIDE_DROPDOWN: { // Setup road-side dropdown - *selected_index = this->opt->vehicle.road_side; - const StringID *items = _driveside_dropdown; - uint disabled = 0; - - /* You can only change the drive side if you are in the menu or ingame with - * no vehicles present. In a networking game only the server can change it */ - extern bool RoadVehiclesAreBuilt(); - if ((_game_mode != GM_MENU && RoadVehiclesAreBuilt()) || (_networking && !_network_server)) { - disabled = ~(1 << this->opt->vehicle.road_side); // disable the other value - } - - for (uint i = 0; *items != INVALID_STRING_ID; items++, i++) { - list.emplace_back(new DropDownListStringItem(*items, i, HasBit(disabled, i))); - } - break; - } - case WID_GO_AUTOSAVE_DROPDOWN: { // Setup autosave dropdown *selected_index = _settings_client.gui.autosave; const StringID *items = _autosave_dropdown; @@ -276,7 +252,6 @@ struct GameOptionsWindow : Window { { switch (widget) { case WID_GO_CURRENCY_DROPDOWN: SetDParam(0, _currency_specs[this->opt->locale.currency].name); break; - case WID_GO_ROADSIDE_DROPDOWN: SetDParam(0, STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_LEFT + this->opt->vehicle.road_side); break; case WID_GO_AUTOSAVE_DROPDOWN: SetDParam(0, _autosave_dropdown[_settings_client.gui.autosave]); break; case WID_GO_LANG_DROPDOWN: SetDParamStr(0, _current_language->own_name); break; case WID_GO_RESOLUTION_DROPDOWN: SetDParam(0, GetCurRes() == _resolutions.size() ? STR_GAME_OPTIONS_RESOLUTION_OTHER : SPECSTR_RESOLUTION_START + GetCurRes()); break; @@ -447,15 +422,6 @@ struct GameOptionsWindow : Window { ReInitAllWindows(); break; - case WID_GO_ROADSIDE_DROPDOWN: // Road side - if (this->opt->vehicle.road_side != index) { // only change if setting changed - uint i; - if (GetSettingFromName("vehicle.road_side", &i) == nullptr) NOT_REACHED(); - SetSettingValue(i, index); - MarkWholeScreenDirty(); - } - break; - case WID_GO_AUTOSAVE_DROPDOWN: // Autosave options _settings_client.gui.autosave = index; this->SetDirty(); @@ -549,9 +515,6 @@ static const NWidgetPart _nested_game_options_widgets[] = { NWidget(WWT_PANEL, COLOUR_GREY, WID_GO_BACKGROUND), SetPIP(6, 6, 10), NWidget(NWID_HORIZONTAL), SetPIP(10, 10, 10), NWidget(NWID_VERTICAL), SetPIP(0, 6, 0), - NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_ROAD_VEHICLES_FRAME, STR_NULL), - NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_ROADSIDE_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_TOOLTIP), SetFill(1, 0), - EndContainer(), NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_AUTOSAVE_FRAME, STR_NULL), NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_AUTOSAVE_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP), SetFill(1, 0), EndContainer(), diff --git a/src/table/settings.ini b/src/table/settings.ini index b0b1f7679..7dd9da255 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -374,6 +374,7 @@ str = STR_CONFIG_SETTING_ROAD_SIDE strhelp = STR_CONFIG_SETTING_ROAD_SIDE_HELPTEXT strval = STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_LEFT proc = CheckRoadSide +cat = SC_BASIC ; Construction diff --git a/src/widgets/settings_widget.h b/src/widgets/settings_widget.h index 2482dfd0b..2eb6180f5 100644 --- a/src/widgets/settings_widget.h +++ b/src/widgets/settings_widget.h @@ -15,7 +15,6 @@ enum GameOptionsWidgets { WID_GO_BACKGROUND, ///< Background of the window. WID_GO_CURRENCY_DROPDOWN, ///< Currency dropdown. WID_GO_DISTANCE_DROPDOWN, ///< Measuring unit dropdown. - WID_GO_ROADSIDE_DROPDOWN, ///< Dropdown to select the road side (to set the right side ;)). WID_GO_AUTOSAVE_DROPDOWN, ///< Dropdown to say how often to autosave. WID_GO_LANG_DROPDOWN, ///< Language dropdown. WID_GO_RESOLUTION_DROPDOWN, ///< Dropdown for the resolution. -- cgit v1.2.3-70-g09d2