mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-20 03:19:19 +02:00
(commands) add epbrakecontrolenable and epbrakecontroldisable
This commit is contained in:
30
Train.cpp
30
Train.cpp
@@ -254,6 +254,8 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
||||
{ user_command::autosandboxactivate, &TTrain::OnCommand_autosandboxactivate },
|
||||
{ user_command::autosandboxdeactivate, &TTrain::OnCommand_autosandboxdeactivate },
|
||||
{ user_command::epbrakecontroltoggle, &TTrain::OnCommand_epbrakecontroltoggle },
|
||||
{ user_command::epbrakecontrolenable, &TTrain::OnCommand_epbrakecontrolenable },
|
||||
{ user_command::epbrakecontroldisable, &TTrain::OnCommand_epbrakecontroldisable },
|
||||
{ user_command::trainbrakeoperationmodeincrease, &TTrain::OnCommand_trainbrakeoperationmodeincrease },
|
||||
{ user_command::trainbrakeoperationmodedecrease, &TTrain::OnCommand_trainbrakeoperationmodedecrease },
|
||||
{ user_command::brakeactingspeedincrease, &TTrain::OnCommand_brakeactingspeedincrease },
|
||||
@@ -1969,6 +1971,34 @@ void TTrain::OnCommand_autosandboxdeactivate(TTrain *Train, command_data const &
|
||||
}
|
||||
};
|
||||
|
||||
void TTrain::OnCommand_epbrakecontrolenable( TTrain *Train, command_data const &Command ) {
|
||||
auto const istoggle{ ( static_cast<int>( Train->ggEPFuseButton.type() ) & static_cast<int>( TGaugeType::toggle ) ) != 0 };
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// command only works for bistable switch
|
||||
if(istoggle) {
|
||||
if( Train->mvOccupied->EpFuseSwitch( true ) ) {
|
||||
// audio feedback
|
||||
if( Train->dsbPneumaticSwitch ) {
|
||||
Train->dsbPneumaticSwitch->play();
|
||||
}
|
||||
Train->ggEPFuseButton.UpdateValue(1.0f, Train->dsbSwitch);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_epbrakecontroldisable( TTrain *Train, command_data const &Command ) {
|
||||
auto const istoggle{ ( static_cast<int>( Train->ggEPFuseButton.type() ) & static_cast<int>( TGaugeType::toggle ) ) != 0 };
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// command only works for bistable switch
|
||||
if(istoggle) {
|
||||
if( Train->mvOccupied->EpFuseSwitch( false ) ) {
|
||||
Train->ggEPFuseButton.UpdateValue(0.0f, Train->dsbSwitch);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_epbrakecontroltoggle( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Command.action == GLFW_REPEAT ) { return; }
|
||||
|
||||
Reference in New Issue
Block a user