mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-21 22:59:19 +02: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 ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
Train->mvOccupied->CompartmentLightsSwitch( true );
|
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
|
// visual feedback
|
||||||
if( Train->m_controlmapper.contains( "compartmentlights_sw:" ) ) {
|
if( Train->m_controlmapper.contains( "compartmentlights_sw:" ) ) {
|
||||||
Train->ggCompartmentLightsButton.UpdateValue( 1.0f, Train->dsbSwitch );
|
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 ) {
|
void TTrain::OnCommand_compartmentlightsdisable( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
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
|
// visual feedback
|
||||||
if( Train->m_controlmapper.contains( "compartmentlights_sw:" ) ) {
|
if( Train->m_controlmapper.contains( "compartmentlights_sw:" ) ) {
|
||||||
Train->ggCompartmentLightsButton.UpdateValue( 0.0f, Train->dsbSwitch );
|
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:" ) ) {
|
if( Train->m_controlmapper.contains( "compartmentlightsoff_sw:" ) ) {
|
||||||
Train->ggCompartmentLightsOffButton.UpdateValue( 1.0f, Train->dsbSwitch );
|
Train->ggCompartmentLightsOffButton.UpdateValue( 1.0f, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
|
|
||||||
Train->mvOccupied->CompartmentLightsSwitchOff( true );
|
|
||||||
}
|
}
|
||||||
else if( Command.action == GLFW_RELEASE ) {
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
if( Train->m_controlmapper.contains( "compartmentlights_sw:" ) ) {
|
if( Train->m_controlmapper.contains( "compartmentlights_sw:" ) ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user