mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 15:41:15 +00:00
Change: move the 'road drive side' selection to settings tree, and give it the same 'basic' visibilty as 'signal side'.
This commit is contained in:
parent
c71d0f5e7f
commit
5a1fa18509
@ -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
|
||||
|
||||
|
@ -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(),
|
||||
|
@ -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
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user