Add setting for whether to show rail polyline tool

pull/621/head
Jonathan G Rennison 9 months ago
parent f24388c0b2
commit 592c038e42

@ -319,6 +319,9 @@ STR_CONFIG_SETTING_SHOW_ORDER_NUMBER_IN_VEHICLE_VIEW_HELPTEXT :When enabled, t
STR_CONFIG_SETTING_HIDE_DEFAULT_STOP_LOCATION :Hide default order stop locations: {STRING2} STR_CONFIG_SETTING_HIDE_DEFAULT_STOP_LOCATION :Hide default order stop locations: {STRING2}
STR_CONFIG_SETTING_HIDE_DEFAULT_STOP_LOCATION_HELPTEXT :When enabled, hide the order stop location when it matches the default. STR_CONFIG_SETTING_HIDE_DEFAULT_STOP_LOCATION_HELPTEXT :When enabled, hide the order stop location when it matches the default.
STR_CONFIG_SHOW_RAIL_POLYLINE_TOOL :Show rail polyline tool: {STRING2}
STR_CONFIG_SHOW_RAIL_POLYLINE_TOOL_HELPTEXT :When enabled, the rail construction toolbar includes a button to build using the polyline mode.
STR_CONFIG_SETTING_ADV_SIG_BRIDGE_TUN_MODES :Enable signals on bridges/tunnels advanced modes: {STRING2} STR_CONFIG_SETTING_ADV_SIG_BRIDGE_TUN_MODES :Enable signals on bridges/tunnels advanced modes: {STRING2}
STR_CONFIG_SETTING_ADV_SIG_BRIDGE_TUN_MODES_HELPTEXT :Enables use of advanced modes of signal simulation on bridges and tunnels. When disabled, bridges/tunnels which are not already in an advanced mode cannot be changed to an advanced mode, however other players may choose to enable this setting and use an advanced mode. STR_CONFIG_SETTING_ADV_SIG_BRIDGE_TUN_MODES_HELPTEXT :Enables use of advanced modes of signal simulation on bridges and tunnels. When disabled, bridges/tunnels which are not already in an advanced mode cannot be changed to an advanced mode, however other players may choose to enable this setting and use an advanced mode.
@ -793,7 +796,7 @@ STR_LINKGRAPH_STATS_TOOLTIP_USAGE :{}Usage: {CARGO
STR_LINKGRAPH_STATS_TOOLTIP_PLANNED :{}Planned: {CARGO_LONG} STR_LINKGRAPH_STATS_TOOLTIP_PLANNED :{}Planned: {CARGO_LONG}
STR_LINKGRAPH_STATS_TOOLTIP_DISTANCE :Manhattan Distance: {COMMA} tile{P 0 "" s}{}Bird Fly Distance: {COMMA} tile{P 1 "" s} STR_LINKGRAPH_STATS_TOOLTIP_DISTANCE :Manhattan Distance: {COMMA} tile{P 0 "" s}{}Bird Fly Distance: {COMMA} tile{P 1 "" s}
STR_RAIL_TOOLBAR_TOOLTIP_BUILD_POLYRAIL :{BLACK}Build railway track using the Polyline mode. Ctrl toggles build/remove for railway construction. Shift toggles building/showing cost estimate STR_RAIL_TOOLBAR_TOOLTIP_BUILD_POLYRAIL :{BLACK}Build railway track using the polyline mode. Ctrl toggles build/remove for railway construction. Shift toggles building/showing cost estimate
STR_BUILD_SIGNAL_SEMAPHORE_PROG_TOOLTIP :{BLACK}Programmable Pre-Signal (semaphore){}The programmable pre-signal is a combo-signal which can be programmed to behave in complex ways. STR_BUILD_SIGNAL_SEMAPHORE_PROG_TOOLTIP :{BLACK}Programmable Pre-Signal (semaphore){}The programmable pre-signal is a combo-signal which can be programmed to behave in complex ways.
STR_BUILD_SIGNAL_SEMAPHORE_NO_ENTRY_TOOLTIP :{BLACK}No-Entry Signal (semaphore){}A path signal allows more than one train to enter a signal block at the same time, if the train can reserve a path to a safe stopping point. No-entry signals can't be passed from the front side STR_BUILD_SIGNAL_SEMAPHORE_NO_ENTRY_TOOLTIP :{BLACK}No-Entry Signal (semaphore){}A path signal allows more than one train to enter a signal block at the same time, if the train can reserve a path to a safe stopping point. No-entry signals can't be passed from the front side

@ -513,6 +513,9 @@ struct BuildRailToolbarWindow : Window {
this->SetupRailToolbar(railtype); this->SetupRailToolbar(railtype);
this->DisableWidget(WID_RAT_REMOVE); this->DisableWidget(WID_RAT_REMOVE);
this->last_user_action = INVALID_WID_RAT; this->last_user_action = INVALID_WID_RAT;
if (!_settings_client.gui.show_rail_polyline_tool) {
this->GetWidget<NWidgetStacked>(WID_RAT_POLYRAIL_SEL)->SetDisplayedPlane(SZSP_NONE);
}
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this); if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
} }
@ -643,6 +646,7 @@ struct BuildRailToolbarWindow : Window {
break; break;
case WID_RAT_POLYRAIL: { case WID_RAT_POLYRAIL: {
if (!_settings_client.gui.show_rail_polyline_tool) break;
bool was_snap = CurrentlySnappingRailPlacement(); bool was_snap = CurrentlySnappingRailPlacement();
bool was_open = this->IsWidgetLowered(WID_RAT_POLYRAIL); bool was_open = this->IsWidgetLowered(WID_RAT_POLYRAIL);
bool do_snap; bool do_snap;
@ -759,6 +763,7 @@ struct BuildRailToolbarWindow : Window {
switch (hotkey) { switch (hotkey) {
case HOTKEY_POLYRAIL: case HOTKEY_POLYRAIL:
case HOTKEY_NEW_POLYRAIL: case HOTKEY_NEW_POLYRAIL:
if (!_settings_client.gui.show_rail_polyline_tool) return ES_HANDLED;
/* Indicate to the OnClick that the action comes from a hotkey rather /* Indicate to the OnClick that the action comes from a hotkey rather
* then from a click and that the CTRL state should be ignored. */ * then from a click and that the CTRL state should be ignored. */
this->last_user_action = hotkey; this->last_user_action = hotkey;
@ -959,6 +964,18 @@ struct BuildRailToolbarWindow : Window {
if (this->IsWidgetLowered(WID_RAT_BUILD_WAYPOINT)) CheckRedrawWaypointCoverage(this, false); if (this->IsWidgetLowered(WID_RAT_BUILD_WAYPOINT)) CheckRedrawWaypointCoverage(this, false);
} }
void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
if (!gui_scope) return;
if (this->GetWidget<NWidgetStacked>(WID_RAT_POLYRAIL_SEL)->SetDisplayedPlane(_settings_client.gui.show_rail_polyline_tool ? 0 : SZSP_NONE)) {
if (this->IsWidgetLowered(WID_RAT_POLYRAIL)) {
ResetObjectToPlace();
}
this->ReInit();
}
}
static HotkeyList hotkeys; static HotkeyList hotkeys;
}; };
@ -1019,8 +1036,10 @@ static const NWidgetPart _nested_build_rail_widgets[] = {
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_RAIL_NW, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TRACK), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_RAIL_NW, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TRACK),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_RAT_AUTORAIL), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_RAT_AUTORAIL),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTORAIL, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_AUTORAIL), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTORAIL, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_AUTORAIL),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_RAT_POLYRAIL), NWidget(NWID_SELECTION, INVALID_COLOUR, WID_RAT_POLYRAIL_SEL),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTORAIL, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_POLYRAIL), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_RAT_POLYRAIL),
SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_AUTORAIL, STR_RAIL_TOOLBAR_TOOLTIP_BUILD_POLYRAIL),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(4, 22), EndContainer(), NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(4, 22), EndContainer(),

@ -2036,6 +2036,7 @@ static SettingsContainer &GetSettingsTree()
construction->Add(new SettingEntry("gui.default_rail_type")); construction->Add(new SettingEntry("gui.default_rail_type"));
construction->Add(new SettingEntry("gui.default_road_type")); construction->Add(new SettingEntry("gui.default_road_type"));
construction->Add(new SettingEntry("gui.demolish_confirm_mode")); construction->Add(new SettingEntry("gui.demolish_confirm_mode"));
construction->Add(new SettingEntry("gui.show_rail_polyline_tool"));
} }
SettingsPage *vehicle_windows = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_VEHICLE_WINDOWS)); SettingsPage *vehicle_windows = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_VEHICLE_WINDOWS));

@ -308,6 +308,7 @@ struct GUISettings : public TimeSettings {
bool show_vehicle_group_hierarchy_name;///< Show the full group hierarchy in vehicle names bool show_vehicle_group_hierarchy_name;///< Show the full group hierarchy in vehicle names
bool show_order_number_vehicle_view; ///< Show order number in vehicle view window bool show_order_number_vehicle_view; ///< Show order number in vehicle view window
bool hide_default_stop_location; ///< Hide default stop location for orders bool hide_default_stop_location; ///< Hide default stop location for orders
bool show_rail_polyline_tool; ///< Show rail polyline tool
uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity. uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity.
uint16 console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed. uint16 console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed.

@ -1605,6 +1605,14 @@ str = STR_CONFIG_SETTING_HIDE_DEFAULT_STOP_LOCATION
strhelp = STR_CONFIG_SETTING_HIDE_DEFAULT_STOP_LOCATION_HELPTEXT strhelp = STR_CONFIG_SETTING_HIDE_DEFAULT_STOP_LOCATION_HELPTEXT
post_cb = [](auto) { SetWindowClassesDirty(WC_VEHICLE_ORDERS); } post_cb = [](auto) { SetWindowClassesDirty(WC_VEHICLE_ORDERS); }
[SDTC_BOOL]
var = gui.show_rail_polyline_tool
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_PATCH
def = true
str = STR_CONFIG_SHOW_RAIL_POLYLINE_TOOL
strhelp = STR_CONFIG_SHOW_RAIL_POLYLINE_TOOL_HELPTEXT
post_cb = [](auto) { InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_RAIL); }
; For the dedicated build we'll enable dates in logs by default. ; For the dedicated build we'll enable dates in logs by default.
[SDTC_BOOL] [SDTC_BOOL]
ifdef = DEDICATED ifdef = DEDICATED

@ -20,6 +20,7 @@ enum RailToolbarWidgets : WidgetID {
WID_RAT_BUILD_Y, ///< Build rail along the game grid Y axis. WID_RAT_BUILD_Y, ///< Build rail along the game grid Y axis.
WID_RAT_AUTORAIL, ///< Autorail tool. WID_RAT_AUTORAIL, ///< Autorail tool.
WID_RAT_POLYRAIL, ///< Polyline rail tool. WID_RAT_POLYRAIL, ///< Polyline rail tool.
WID_RAT_POLYRAIL_SEL, ///< Select widget for polyline rail tool.
WID_RAT_DEMOLISH, ///< Destroy something with dynamite! WID_RAT_DEMOLISH, ///< Destroy something with dynamite!
WID_RAT_BUILD_DEPOT, ///< Build a depot. WID_RAT_BUILD_DEPOT, ///< Build a depot.
WID_RAT_BUILD_WAYPOINT, ///< Build a waypoint. WID_RAT_BUILD_WAYPOINT, ///< Build a waypoint.

Loading…
Cancel
Save