mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
(commands) add radiostopenable and radiostopdisable commands
This commit is contained in:
20
Train.cpp
20
Train.cpp
@@ -431,6 +431,8 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
|||||||
{ user_command::radiochannelincrease, &TTrain::OnCommand_radiochannelincrease },
|
{ user_command::radiochannelincrease, &TTrain::OnCommand_radiochannelincrease },
|
||||||
{ user_command::radiochanneldecrease, &TTrain::OnCommand_radiochanneldecrease },
|
{ user_command::radiochanneldecrease, &TTrain::OnCommand_radiochanneldecrease },
|
||||||
{ user_command::radiostopsend, &TTrain::OnCommand_radiostopsend },
|
{ 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::radiostoptest, &TTrain::OnCommand_radiostoptest },
|
||||||
{ user_command::radiocall3send, &TTrain::OnCommand_radiocall3send },
|
{ user_command::radiocall3send, &TTrain::OnCommand_radiocall3send },
|
||||||
{ user_command::radiovolumeincrease, &TTrain::OnCommand_radiovolumeincrease },
|
{ 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 ) {
|
void TTrain::OnCommand_radiostoptest( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
|
|||||||
2
Train.h
2
Train.h
@@ -453,6 +453,8 @@ class TTrain {
|
|||||||
static void OnCommand_radiochannelincrease( TTrain *Train, command_data const &Command );
|
static void OnCommand_radiochannelincrease( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_radiochanneldecrease( 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_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_radiostoptest( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_radiocall3send( 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);
|
static void OnCommand_radiovolumeincrease(TTrain *Train, command_data const &Command);
|
||||||
|
|||||||
@@ -141,6 +141,8 @@ commanddescription_sequence Commands_descriptions = {
|
|||||||
{ "radiochannelincrease", command_target::vehicle, command_mode::oneoff },
|
{ "radiochannelincrease", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "radiochanneldecrease", command_target::vehicle, command_mode::oneoff },
|
{ "radiochanneldecrease", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "radiostopsend", 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 },
|
{ "radiostoptest", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "radiocall3send", command_target::vehicle, command_mode::oneoff },
|
{ "radiocall3send", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "radiovolumeincrease", command_target::vehicle, command_mode::oneoff },
|
{ "radiovolumeincrease", command_target::vehicle, command_mode::oneoff },
|
||||||
|
|||||||
@@ -134,6 +134,8 @@ enum class user_command {
|
|||||||
radiochannelincrease,
|
radiochannelincrease,
|
||||||
radiochanneldecrease,
|
radiochanneldecrease,
|
||||||
radiostopsend,
|
radiostopsend,
|
||||||
|
radiostopenable,
|
||||||
|
radiostopdisable,
|
||||||
radiostoptest,
|
radiostoptest,
|
||||||
radiocall3send,
|
radiocall3send,
|
||||||
radiovolumeincrease,
|
radiovolumeincrease,
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ driverkeyboard_input::default_bindings() {
|
|||||||
{ user_command::radiochannelincrease, GLFW_KEY_EQUAL },
|
{ user_command::radiochannelincrease, GLFW_KEY_EQUAL },
|
||||||
{ user_command::radiochanneldecrease, GLFW_KEY_MINUS },
|
{ user_command::radiochanneldecrease, GLFW_KEY_MINUS },
|
||||||
{ user_command::radiostopsend, GLFW_KEY_PAUSE | keymodifier::shift | keymodifier::control },
|
{ user_command::radiostopsend, GLFW_KEY_PAUSE | keymodifier::shift | keymodifier::control },
|
||||||
|
// radiostopenable
|
||||||
|
// radiostopdisable
|
||||||
{ user_command::radiostoptest, GLFW_KEY_R | keymodifier::shift | keymodifier::control },
|
{ user_command::radiostoptest, GLFW_KEY_R | keymodifier::shift | keymodifier::control },
|
||||||
{ user_command::radiocall3send, GLFW_KEY_BACKSPACE },
|
{ user_command::radiocall3send, GLFW_KEY_BACKSPACE },
|
||||||
// radiovolumeincrease,
|
// radiovolumeincrease,
|
||||||
|
|||||||
@@ -794,6 +794,12 @@ drivermouse_input::default_bindings() {
|
|||||||
{ "radiostop_sw:", {
|
{ "radiostop_sw:", {
|
||||||
user_command::radiostopsend,
|
user_command::radiostopsend,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
{ "radiostopon_sw:", {
|
||||||
|
user_command::radiostopenable,
|
||||||
|
user_command::none } },
|
||||||
|
{ "radiostopoff_sw:", {
|
||||||
|
user_command::radiostopdisable,
|
||||||
|
user_command::none } },
|
||||||
{ "radiotest_sw:", {
|
{ "radiotest_sw:", {
|
||||||
user_command::radiostoptest,
|
user_command::radiostoptest,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
|||||||
@@ -675,6 +675,12 @@ std::unordered_map<std::string, vr_openvr::button_bindings> vr_openvr::m_buttonb
|
|||||||
{ "radiostop_sw:", {
|
{ "radiostop_sw:", {
|
||||||
user_command::radiostopsend,
|
user_command::radiostopsend,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
{ "radiostopon_sw:", {
|
||||||
|
user_command::radiostopenable,
|
||||||
|
user_command::none } },
|
||||||
|
{ "radiostopoff_sw:", {
|
||||||
|
user_command::radiostopdisable,
|
||||||
|
user_command::none } },
|
||||||
{ "radiotest_sw:", {
|
{ "radiotest_sw:", {
|
||||||
user_command::radiostoptest,
|
user_command::radiostoptest,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
|||||||
Reference in New Issue
Block a user