mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
compartment map cab control logic fix
This commit is contained in:
15
Train.cpp
15
Train.cpp
@@ -4516,6 +4516,12 @@ void TTrain::OnCommand_compartmentlightsenable( TTrain *Train, command_data cons
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
Train->mvOccupied->CompartmentLightsSwitch( true );
|
||||
if( Train->m_controlmapper.contains( "compartmentlights_sw:" ) ) {
|
||||
auto const istoggle{ ( static_cast<int>( Train->ggCompartmentLightsButton.type() ) & static_cast<int>( TGaugeType::toggle ) ) != 0 };
|
||||
if( istoggle ) {
|
||||
Train->mvOccupied->CompartmentLightsSwitchOff( false );
|
||||
}
|
||||
}
|
||||
// visual feedback
|
||||
if( Train->m_controlmapper.contains( "compartmentlights_sw:" ) ) {
|
||||
Train->ggCompartmentLightsButton.UpdateValue( 1.0f, Train->dsbSwitch );
|
||||
@@ -4543,6 +4549,13 @@ void TTrain::OnCommand_compartmentlightsenable( TTrain *Train, command_data cons
|
||||
void TTrain::OnCommand_compartmentlightsdisable( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
Train->mvOccupied->CompartmentLightsSwitchOff( true );
|
||||
if( Train->m_controlmapper.contains( "compartmentlights_sw:" ) ) {
|
||||
auto const istoggle{ ( static_cast<int>( Train->ggCompartmentLightsButton.type() ) & static_cast<int>( TGaugeType::toggle ) ) != 0 };
|
||||
if( istoggle ) {
|
||||
Train->mvOccupied->CompartmentLightsSwitch( false );
|
||||
}
|
||||
}
|
||||
// visual feedback
|
||||
if( Train->m_controlmapper.contains( "compartmentlights_sw:" ) ) {
|
||||
Train->ggCompartmentLightsButton.UpdateValue( 0.0f, Train->dsbSwitch );
|
||||
@@ -4550,8 +4563,6 @@ void TTrain::OnCommand_compartmentlightsdisable( TTrain *Train, command_data con
|
||||
if( Train->m_controlmapper.contains( "compartmentlightsoff_sw:" ) ) {
|
||||
Train->ggCompartmentLightsOffButton.UpdateValue( 1.0f, Train->dsbSwitch );
|
||||
}
|
||||
|
||||
Train->mvOccupied->CompartmentLightsSwitchOff( true );
|
||||
}
|
||||
else if( Command.action == GLFW_RELEASE ) {
|
||||
if( Train->m_controlmapper.contains( "compartmentlights_sw:" ) ) {
|
||||
|
||||
Reference in New Issue
Block a user