Feature: Remember the last-used signal between games (#9792)

This commit is contained in:
Tyler Trahan
2022-02-02 14:26:46 -07:00
committed by Patric Stout
parent 8639e222c8
commit 45a1036177
3 changed files with 16 additions and 3 deletions

View File

@@ -250,7 +250,7 @@ static void GenericPlaceSignals(TileIndex tile)
} else {
SB(p1, 3, 1, _ctrl_pressed);
SB(p1, 4, 1, (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC));
SB(p1, 5, 3, SIGTYPE_PBS_ONEWAY);
SB(p1, 5, 3, _settings_client.gui.default_signal_type);
SB(p1, 8, 1, 0);
SB(p1, 9, 6, cycle_types);
}
@@ -407,7 +407,7 @@ static void HandleAutoSignalPlacement()
SB(p2, 3, 1, 0);
SB(p2, 4, 1, (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC));
SB(p2, 6, 1, _ctrl_pressed);
SB(p2, 7, 3, SIGTYPE_PBS_ONEWAY);
SB(p2, 7, 3, _settings_client.gui.default_signal_type);
SB(p2, 24, 8, _settings_client.gui.drag_signals_density);
SB(p2, 10, 1, !_settings_client.gui.drag_signals_fixed_distance);
}
@@ -1797,6 +1797,9 @@ public:
_cur_signal_type = (SignalType)((uint)((widget - WID_BS_SEMAPHORE_NORM) % (SIGTYPE_LAST + 1)));
_cur_signal_variant = widget >= WID_BS_ELECTRIC_NORM ? SIG_ELECTRIC : SIG_SEMAPHORE;
/* Update default (last-used) signal type in config file. */
_settings_client.gui.default_signal_type = _cur_signal_type;
/* If 'remove' button of rail build toolbar is active, disable it. */
if (_remove_button_clicked) {
Window *w = FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL);
@@ -2204,7 +2207,7 @@ void InitializeRailGUI()
SetDefaultRailGui();
_convert_signal_button = false;
_cur_signal_type = SIGTYPE_PBS_ONEWAY;
_cur_signal_type = _settings_client.gui.default_signal_type;
ResetSignalVariant();
}