diff --git a/src/lang/english.txt b/src/lang/english.txt index 424e85640c..bad9d1c107 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1316,6 +1316,8 @@ STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF :Show restricted STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF_HELPTEXT :Show electric signals with routing restriction programs using the default signal graphics with a blue signal post, instead of using any NewGRF signal graphics. This is to make it easier to visually distinguish restricted signals. STR_CONFIG_SETTING_SHOW_ADV_TRACE_RESTRICT_FEATURES :Show advanced routing restriction features: {STRING2} STR_CONFIG_SETTING_SHOW_ADV_TRACE_RESTRICT_FEATURES_HELPTEXT :Show advanced routing restriction features. When disabled, some advanced features are not shown in the UI, but are still available to all players. +STR_CONFIG_SETTING_SHOW_PROGSIG_FEATURES :Show programmable signal feature: {STRING2} +STR_CONFIG_SETTING_SHOW_PROGSIG_FEATURES_HELPTEXT :Show programmable signal feature. When disabled, the buttons to build and configure programmable signals are not shown in the UI, but are still available to all players. STR_CONFIG_SETTING_LANDSCAPE :Landscape: {STRING2} STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT :Landscapes define basic gameplay scenarios with different cargos and town growth requirements. NewGRF and Game Scripts allow finer control though @@ -1821,6 +1823,7 @@ STR_CONFIG_SETTING_INTERFACE_CONSTRUCTION :{ORANGE}Constru STR_CONFIG_SETTING_INTERFACE_DEPARTUREBOARDS :{ORANGE}Departure boards STR_CONFIG_SETTING_INTERFACE_WALLCLOCK :{ORANGE}Wall clock STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}Timetables +STR_CONFIG_SETTING_INTERFACE_ADV_SIGNALS :{ORANGE}Signals (advanced) STR_CONFIG_SETTING_ADVISORS :{ORANGE}News / Advisors STR_CONFIG_SETTING_COMPANY :{ORANGE}Company STR_CONFIG_SETTING_ACCOUNTING :{ORANGE}Accounting diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 6b8cc0ef4a..28b76da779 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -1604,6 +1604,7 @@ struct BuildSignalWindow : public PickerWindowBase { private: Dimension sig_sprite_size; ///< Maximum size of signal GUI sprites. int sig_sprite_bottom_offset; ///< Maximum extent of signal GUI sprite from reference point towards bottom. + bool progsig_ui_shown; ///< Whether programmable signal UI is shown /** * Draw dynamic a signal-sprite in a button in the signal GUI @@ -1627,10 +1628,19 @@ private: y + this->IsWidgetLowered(widget_index)); } + void SetProgsigUiShown() { + this->progsig_ui_shown = _settings_client.gui.show_progsig_ui; + this->GetWidget(WID_BS_SEMAPHORE_PROG_SEL)->SetDisplayedPlane(_settings_client.gui.show_progsig_ui ? 0 : SZSP_NONE); + this->GetWidget(WID_BS_ELECTRIC_PROG_SEL)->SetDisplayedPlane(_settings_client.gui.show_progsig_ui ? 0 : SZSP_NONE); + this->GetWidget(WID_BS_PROGRAM_SEL)->SetDisplayedPlane(_settings_client.gui.show_progsig_ui ? 0 : 1); + } + public: BuildSignalWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent) { - this->InitNested(TRANSPORT_RAIL); + this->CreateNestedTree(); + this->SetProgsigUiShown(); + this->FinishInitNested(TRANSPORT_RAIL); this->OnInvalidateData(); } @@ -1799,6 +1809,11 @@ public: this->SetWidgetDisabledState(WID_BS_DRAG_SIGNALS_DENSITY_DECREASE, _settings_client.gui.drag_signals_density == 1); this->SetWidgetDisabledState(WID_BS_DRAG_SIGNALS_DENSITY_INCREASE, _settings_client.gui.drag_signals_density == 20); + + if (this->progsig_ui_shown != _settings_client.gui.show_progsig_ui) { + this->SetProgsigUiShown(); + this->ReInit(); + } } }; @@ -1814,7 +1829,9 @@ static const NWidgetPart _nested_signal_builder_widgets[] = { NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_ENTRY), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_ENTRY_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_EXIT), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_EXIT_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_COMBO), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_COMBO_TOOLTIP), EndContainer(), SetFill(1, 1), - NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_PROG), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_PROG_TOOLTIP), EndContainer(), SetFill(1, 1), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BS_SEMAPHORE_PROG_SEL), + NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_PROG), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_PROG_TOOLTIP), EndContainer(), SetFill(1, 1), + EndContainer(), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_PBS), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_PBS_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_PBS_OWAY), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_PBS_OWAY_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_BS_CONVERT), SetDataTip(SPR_IMG_SIGNAL_CONVERT, STR_BUILD_SIGNAL_CONVERT_TOOLTIP), SetFill(1, 1), @@ -1825,7 +1842,9 @@ static const NWidgetPart _nested_signal_builder_widgets[] = { NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_ENTRY), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_ENTRY_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_EXIT), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_EXIT_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_COMBO), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_COMBO_TOOLTIP), EndContainer(), SetFill(1, 1), - NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_PROG), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_PROG_TOOLTIP), EndContainer(), SetFill(1, 1), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BS_ELECTRIC_PROG_SEL), + NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_PROG), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_PROG_TOOLTIP), EndContainer(), SetFill(1, 1), + EndContainer(), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_PBS), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_PBS_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_PBS_OWAY), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_PBS_OWAY_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_TOOLTIP), SetFill(1, 1), @@ -1838,7 +1857,10 @@ static const NWidgetPart _nested_signal_builder_widgets[] = { EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 2), SetFill(1, 0), EndContainer(), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_BS_PROGRAM), SetDataTip(SPR_IMG_SETTINGS, STR_PROGRAM_SIGNAL_TOOLTIP), SetFill(1, 1), + NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BS_PROGRAM_SEL), + NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_BS_PROGRAM), SetDataTip(SPR_IMG_SETTINGS, STR_PROGRAM_SIGNAL_TOOLTIP), SetFill(1, 1), + NWidget(WWT_PANEL, COLOUR_DARK_GREEN), EndContainer(), SetFill(1, 1), + EndContainer(), EndContainer(), EndContainer(), }; diff --git a/src/settings.cpp b/src/settings.cpp index 521ee2cb5e..6fa225de36 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1062,6 +1062,13 @@ static bool DragSignalsDensityChanged(int32) return true; } +static bool ProgrammableSignalsShownChanged(int32) +{ + InvalidateWindowData(WC_BUILD_SIGNAL, 0); + + return true; +} + static bool TownFoundingChanged(int32 p1) { if (_game_mode != GM_EDITOR && _settings_game.economy.found_town == TF_FORBIDDEN) { diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index c60ca789da..4fad9ed913 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1592,6 +1592,12 @@ static SettingsContainer &GetSettingsTree() timetable->Add(new SettingEntry("gui.timetable_arrival_departure")); } + SettingsPage *advsig = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_ADV_SIGNALS)); + { + advsig->Add(new SettingEntry("gui.show_progsig_ui")); + advsig->Add(new SettingEntry("gui.show_adv_tracerestrict_features")); + } + interface->Add(new SettingEntry("gui.autosave")); interface->Add(new SettingEntry("gui.toolbar_pos")); interface->Add(new SettingEntry("gui.statusbar_pos")); @@ -1602,7 +1608,6 @@ static SettingsContainer &GetSettingsTree() interface->Add(new SettingEntry("gui.show_train_weight_ratios_in_details")); interface->Add(new SettingEntry("gui.show_vehicle_group_in_details")); interface->Add(new SettingEntry("gui.show_vehicle_list_company_colour")); - interface->Add(new SettingEntry("gui.show_adv_tracerestrict_features")); } SettingsPage *advisors = main->Add(new SettingsPage(STR_CONFIG_SETTING_ADVISORS)); diff --git a/src/settings_type.h b/src/settings_type.h index 4f98a34938..3097255678 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -173,6 +173,7 @@ struct GUISettings { bool show_vehicle_group_in_details; ///< show vehicle group in vehicle details window top widget bool show_restricted_signal_default; ///< Show restricted electric signals using the default sprite bool show_adv_tracerestrict_features; ///< Show advanced trace restrict features in UI + bool show_progsig_ui; ///< Show programmable signals feature in UI uint8 osk_activation; ///< Mouse gesture to trigger the OSK. bool show_vehicle_route_steps; ///< when a window related to a specific vehicle is focused, show route steps bool show_vehicle_list_company_colour; ///< show the company colour of vehicles which have an owner different to the owner of the vehicle list diff --git a/src/table/settings.ini b/src/table/settings.ini index ce07f5e0c5..0b2ba3a796 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -24,6 +24,7 @@ static bool RoadVehAccelerationModelChanged(int32 p1); static bool TrainSlopeSteepnessChanged(int32 p1); static bool RoadVehSlopeSteepnessChanged(int32 p1); static bool DragSignalsDensityChanged(int32); +static bool ProgrammableSignalsShownChanged(int32); static bool TownFoundingChanged(int32 p1); static bool DifficultyNoiseChange(int32 i); static bool MaxNoAIsChange(int32 i); @@ -4112,6 +4113,15 @@ strhelp = STR_CONFIG_SETTING_SHOW_ADV_TRACE_RESTRICT_FEATURES_HELPTEXT proc = RedrawScreen cat = SC_EXPERT +[SDTC_BOOL] +var = gui.show_progsig_ui +flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC +def = false +str = STR_CONFIG_SETTING_SHOW_PROGSIG_FEATURES +strhelp = STR_CONFIG_SETTING_SHOW_PROGSIG_FEATURES_HELPTEXT +proc = ProgrammableSignalsShownChanged +cat = SC_ADVANCED + [SDTC_BOOL] var = gui.enable_single_veh_shared_order_gui flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC diff --git a/src/widgets/rail_widget.h b/src/widgets/rail_widget.h index 8e5976f4d4..56ad65d195 100644 --- a/src/widgets/rail_widget.h +++ b/src/widgets/rail_widget.h @@ -99,6 +99,9 @@ enum BuildSignalWidgets { WID_BS_DRAG_SIGNALS_DENSITY_LABEL, ///< The current signal density. WID_BS_DRAG_SIGNALS_DENSITY_DECREASE, ///< Decrease the signal density. WID_BS_DRAG_SIGNALS_DENSITY_INCREASE, ///< Increase the signal density. + WID_BS_SEMAPHORE_PROG_SEL, ///< NWID_SELECTION for WID_BS_SEMAPHORE_PROG + WID_BS_ELECTRIC_PROG_SEL, ///< NWID_SELECTION for WID_BS_ELECTRIC_PROG + WID_BS_PROGRAM_SEL, ///< NWID_SELECTION for WID_BS_PROGRAM }; /** Widgets of the #BuildRailDepotWindow class. */