diff --git a/Train.cpp b/Train.cpp index f59e9f1d..6701fc10 100644 --- a/Train.cpp +++ b/Train.cpp @@ -431,6 +431,8 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = { { user_command::radiochannelincrease, &TTrain::OnCommand_radiochannelincrease }, { user_command::radiochanneldecrease, &TTrain::OnCommand_radiochanneldecrease }, { user_command::radiostopsend, &TTrain::OnCommand_radiostopsend }, + { user_command::radiostopenable, &TTrain::OnCommand_radiostopenable }, + { user_command::radiostopdisable, &TTrain::OnCommand_radiostopdisable }, { user_command::radiostoptest, &TTrain::OnCommand_radiostoptest }, { user_command::radiocall3send, &TTrain::OnCommand_radiocall3send }, { user_command::radiovolumeincrease, &TTrain::OnCommand_radiovolumeincrease }, @@ -6476,6 +6478,24 @@ void TTrain::OnCommand_radiostopsend( TTrain *Train, command_data const &Command } } +void TTrain::OnCommand_radiostopenable( TTrain *Train, command_data const &Command ) { + if( Command.action == GLFW_PRESS && Train->ggRadioStop.GetValue() == 0 ) { + if( ( true == Train->mvOccupied->Radio ) + && ( Train->mvOccupied->Power24vIsAvailable || Train->mvOccupied->Power110vIsAvailable ) ) { + simulation::Region->RadioStop( Train->Dynamic()->GetPosition() ); + } + // visual feedback + Train->ggRadioStop.UpdateValue( 1.0 ); + } +} + +void TTrain::OnCommand_radiostopdisable( TTrain *Train, command_data const &Command ) { + if( Command.action == GLFW_PRESS && Train->ggRadioStop.GetValue() > 0 ) { + // visual feedback + Train->ggRadioStop.UpdateValue( 0.0 ); + } +} + void TTrain::OnCommand_radiostoptest( TTrain *Train, command_data const &Command ) { if( Command.action == GLFW_PRESS ) { diff --git a/Train.h b/Train.h index 407f6590..502dc244 100644 --- a/Train.h +++ b/Train.h @@ -453,6 +453,8 @@ class TTrain { static void OnCommand_radiochannelincrease( TTrain *Train, command_data const &Command ); static void OnCommand_radiochanneldecrease( TTrain *Train, command_data const &Command ); static void OnCommand_radiostopsend( TTrain *Train, command_data const &Command ); + static void OnCommand_radiostopenable( TTrain *Train, command_data const &Command ); + static void OnCommand_radiostopdisable( TTrain *Train, command_data const &Command ); static void OnCommand_radiostoptest( TTrain *Train, command_data const &Command ); static void OnCommand_radiocall3send( TTrain *Train, command_data const &Command ); static void OnCommand_radiovolumeincrease(TTrain *Train, command_data const &Command); diff --git a/command.cpp b/command.cpp index f9e59b06..605e174f 100644 --- a/command.cpp +++ b/command.cpp @@ -141,6 +141,8 @@ commanddescription_sequence Commands_descriptions = { { "radiochannelincrease", command_target::vehicle, command_mode::oneoff }, { "radiochanneldecrease", command_target::vehicle, command_mode::oneoff }, { "radiostopsend", command_target::vehicle, command_mode::oneoff }, + { "radiostopenable", command_target::vehicle, command_mode::oneoff }, + { "radiostopdisable", command_target::vehicle, command_mode::oneoff }, { "radiostoptest", command_target::vehicle, command_mode::oneoff }, { "radiocall3send", command_target::vehicle, command_mode::oneoff }, { "radiovolumeincrease", command_target::vehicle, command_mode::oneoff }, diff --git a/command.h b/command.h index 61810e37..41030524 100644 --- a/command.h +++ b/command.h @@ -134,6 +134,8 @@ enum class user_command { radiochannelincrease, radiochanneldecrease, radiostopsend, + radiostopenable, + radiostopdisable, radiostoptest, radiocall3send, radiovolumeincrease, diff --git a/driverkeyboardinput.cpp b/driverkeyboardinput.cpp index 7ed2580d..15410f98 100644 --- a/driverkeyboardinput.cpp +++ b/driverkeyboardinput.cpp @@ -142,6 +142,8 @@ driverkeyboard_input::default_bindings() { { user_command::radiochannelincrease, GLFW_KEY_EQUAL }, { user_command::radiochanneldecrease, GLFW_KEY_MINUS }, { user_command::radiostopsend, GLFW_KEY_PAUSE | keymodifier::shift | keymodifier::control }, + // radiostopenable + // radiostopdisable { user_command::radiostoptest, GLFW_KEY_R | keymodifier::shift | keymodifier::control }, { user_command::radiocall3send, GLFW_KEY_BACKSPACE }, // radiovolumeincrease, diff --git a/drivermouseinput.cpp b/drivermouseinput.cpp index c611321c..bdbde82d 100644 --- a/drivermouseinput.cpp +++ b/drivermouseinput.cpp @@ -794,6 +794,12 @@ drivermouse_input::default_bindings() { { "radiostop_sw:", { user_command::radiostopsend, user_command::none } }, + { "radiostopon_sw:", { + user_command::radiostopenable, + user_command::none } }, + { "radiostopoff_sw:", { + user_command::radiostopdisable, + user_command::none } }, { "radiotest_sw:", { user_command::radiostoptest, user_command::none } }, diff --git a/vr/openvr_imp.cpp b/vr/openvr_imp.cpp index 3edbc6c9..dcec1e2b 100644 --- a/vr/openvr_imp.cpp +++ b/vr/openvr_imp.cpp @@ -675,6 +675,12 @@ std::unordered_map vr_openvr::m_buttonb { "radiostop_sw:", { user_command::radiostopsend, user_command::none } }, + { "radiostopon_sw:", { + user_command::radiostopenable, + user_command::none } }, + { "radiostopoff_sw:", { + user_command::radiostopdisable, + user_command::none } }, { "radiotest_sw:", { user_command::radiostoptest, user_command::none } },