* Build new signals or remove signals or (if only one tile marked) edit a signal. * * If one tile marked abort and use GenericPlaceSignals() * else use CmdBuildSingleSignal() or CmdRemoveSingleSignal() in rail_cmd.cpp to build many signals */
| 411 | * else use CmdBuildSingleSignal() or CmdRemoveSingleSignal() in rail_cmd.cpp to build many signals |
| 412 | */ |
| 413 | static void HandleAutoSignalPlacement() |
| 414 | { |
| 415 | Track track = (Track)GB(_thd.drawstyle, 0, 3); // 0..5 |
| 416 | |
| 417 | if ((_thd.drawstyle & HT_DRAG_MASK) == HT_RECT) { // one tile case |
| 418 | GenericPlaceSignals(TileVirtXY(_thd.selend.x, _thd.selend.y)); |
| 419 | return; |
| 420 | } |
| 421 | |
| 422 | /* _settings_client.gui.drag_signals_density is given as a parameter such that each user |
| 423 | * in a network game can specify their own signal density */ |
| 424 | if (_remove_button_clicked) { |
| 425 | Command<CMD_REMOVE_SIGNAL_TRACK>::Post(STR_ERROR_CAN_T_REMOVE_SIGNALS_FROM, CcPlaySound_CONSTRUCTION_RAIL, |
| 426 | TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), track, _ctrl_pressed); |
| 427 | } else { |
| 428 | bool sig_gui = FindWindowById(WC_BUILD_SIGNAL, 0) != nullptr; |
| 429 | SignalType sigtype = sig_gui ? _cur_signal_type : _settings_client.gui.default_signal_type; |
| 430 | SignalVariant sigvar = sig_gui ? _cur_signal_variant : (TimerGameCalendar::year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC); |
| 431 | Command<CMD_BUILD_SIGNAL_TRACK>::Post(STR_ERROR_CAN_T_BUILD_SIGNALS_HERE, CcPlaySound_CONSTRUCTION_RAIL, |
| 432 | TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), track, sigtype, sigvar, false, _ctrl_pressed, !_settings_client.gui.drag_signals_fixed_distance, _settings_client.gui.drag_signals_density); |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | |
| 437 | /** Rail toolbar management class. */ |
no test coverage detected