(commands) add radiostopenable and radiostopdisable commands

This commit is contained in:
Marcin Nowak
2022-09-28 23:29:36 +02:00
parent 7880063f5c
commit 57dbcf79e1
7 changed files with 40 additions and 0 deletions

View File

@@ -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 ) {