diff --git a/cm_changelog.txt b/cm_changelog.txt index e66cfe4e05..ca6d2ce5d5 100644 --- a/cm_changelog.txt +++ b/cm_changelog.txt @@ -77,6 +77,7 @@ This is usable for any OpenTTD servers *** 14.0-RC1 (22 Feb 2024) *** - Added hotkeys to save and load blueprints into slots (no gui yet). - Added build info overlay for the tools with build preview. +- Added setting to invert Fn(Ctrl) behaviour when building signals by dragging. - Removed hotkeys that were added to vanilla, renamed the rest to have cm_ prefix. - Fixed colours on 32bpp sprites with CC (#14). - Fixed real town population and house stats in newly created games. diff --git a/src/citymania/cm_hotkeys.cpp b/src/citymania/cm_hotkeys.cpp index 87f3cb2a9e..c0a696d770 100644 --- a/src/citymania/cm_hotkeys.cpp +++ b/src/citymania/cm_hotkeys.cpp @@ -272,5 +272,9 @@ bool RoadToolbar_RemoveModChanged(Window *w, bool remove_active, bool button_cli return remove_active; } +bool ChooseSignalDragBehaviour() { + if (_settings_client.gui.cm_invert_fn_for_signal_drag) return !_fn_mod; + return _fn_mod; +} } // namespace citymania diff --git a/src/citymania/cm_hotkeys.hpp b/src/citymania/cm_hotkeys.hpp index 7515559174..4b2667723c 100644 --- a/src/citymania/cm_hotkeys.hpp +++ b/src/citymania/cm_hotkeys.hpp @@ -29,6 +29,7 @@ bool RoadToolbar_RemoveModChanged(Window *w, bool remove_active, bool button_cli void CountEffectiveAction(); void ResetEffectiveActionCounter(); std::pair GetEPM(); +bool ChooseSignalDragBehaviour(); } // namespace citymania diff --git a/src/lang/english.txt b/src/lang/english.txt index cc5bea16b6..9c316536db 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -6229,7 +6229,8 @@ CM_STR_CONFIG_SETTING_IMPROVED_STATION_JOIN_HELPTEXT :Use Fn-click on CM_STR_CONFIG_SETTING_VEHICLES_CTRL :{ORANGE}Controls & Orders CM_STR_CONFIG_SETTING_AUTOSET_NOLOAD_ON_TRANSFER :"Transfer" orders are "No Loading" by default: {STRING2} CM_STR_CONFIG_SETTING_AUTOSET_NOLOAD_ON_UNLOAD :"Unload all" orders are "No Loading" by default: {STRING2} -CM_STR_CONFIG_SETTING_INVERT_FN_FOR_SIGNALS :Invert the effect of Fn modifier when building signals: {STRING2} +CM_STR_CONFIG_SETTING_INVERT_FN_FOR_SIGNAL_DRAG :Invert the effect of Fn modifier when dragging signals: {STRING2} +CM_STR_CONFIG_SETTING_INVERT_FN_FOR_SIGNAL_DRAG_HELPTEXT :When enabled building signals by dragging places them to the next junction by default and does fixed length when Fn is pressed. CM_STR_TOGGLE_CLIENTS_OVERLAY :{BLACK}Toggle client list overlay. diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 476cfb5052..4e1a59108f 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -408,13 +408,13 @@ static void HandleAutoSignalPlacement() if (_remove_button_clicked) { // TODO invert ctrl option Command::Post(STR_ERROR_CAN_T_REMOVE_SIGNALS_FROM, CcPlaySound_CONSTRUCTION_RAIL, - TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), track, citymania::_fn_mod); + TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), track, citymania::ChooseSignalDragBehaviour()); } else { bool sig_gui = FindWindowById(WC_BUILD_SIGNAL, 0) != nullptr; SignalType sigtype = sig_gui ? _cur_signal_type : _settings_client.gui.default_signal_type; SignalVariant sigvar = sig_gui ? _cur_signal_variant : (TimerGameCalendar::year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC); Command::Post(STR_ERROR_CAN_T_BUILD_SIGNALS_HERE, CcPlaySound_CONSTRUCTION_RAIL, - TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), track, sigtype, sigvar, false, citymania::_fn_mod, !_settings_client.gui.drag_signals_fixed_distance, _settings_client.gui.drag_signals_density); + TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), track, sigtype, sigvar, false, citymania::ChooseSignalDragBehaviour(), !_settings_client.gui.drag_signals_fixed_distance, _settings_client.gui.drag_signals_density); } } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index be372eb675..fea71014dc 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -2051,6 +2051,7 @@ static SettingsContainer &GetSettingsTree() construction->Add(new SettingEntry("gui.cm_open_orders_for_new_vehicles")); construction->Add(new SettingEntry("gui.cm_use_improved_station_join")); construction->Add(new SettingEntry("gui.cm_enable_polyrail_terraform")); + construction->Add(new SettingEntry("gui.cm_invert_fn_for_signal_drag")); } interface->Add(new SettingEntry("gui.toolbar_pos")); diff --git a/src/settings_type.h b/src/settings_type.h index 99293f61f0..2d801beab8 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -262,6 +262,7 @@ struct GUISettings { uint8 cm_graph_background; bool cm_show_client_overlay; bool cm_enable_polyrail_terraform; + bool cm_invert_fn_for_signal_drag; /* CityMania code end */ /** diff --git a/src/table/settings/cmclient_settings.ini b/src/table/settings/cmclient_settings.ini index c112df064c..617a07bd84 100644 --- a/src/table/settings/cmclient_settings.ini +++ b/src/table/settings/cmclient_settings.ini @@ -284,8 +284,8 @@ strhelp = CM_STR_CONFIG_SETTING_ENABLE_POLYRAIL_TERRAFORM_HELPTEXT cat = SC_EXPERT [SDTC_BOOL] -var = gui.cm_invert_ctrl_for_signals +var = gui.cm_invert_fn_for_signal_drag def = false -str = CM_STR_CONFIG_SETTING_ENABLE_POLYRAIL_TERRAFORM -strhelp = CM_STR_CONFIG_SETTING_ENABLE_POLYRAIL_TERRAFORM_HELPTEXT +str = CM_STR_CONFIG_SETTING_INVERT_FN_FOR_SIGNAL_DRAG +strhelp = CM_STR_CONFIG_SETTING_INVERT_FN_FOR_SIGNAL_DRAG_HELPTEXT cat = SC_BASIC