From 72947b00b9727f8d5c9d3785d01e8b29bdcd2bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20GNIEWEK?= Date: Sun, 23 Oct 2022 10:48:50 +0200 Subject: [PATCH] Fixed battery switch sound being repeted --- .../SubSystems/PowerSupplies/BatterySwitch.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies/BatterySwitch.cs b/Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies/BatterySwitch.cs index 8678386a72..cbc03c17f7 100644 --- a/Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies/BatterySwitch.cs +++ b/Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies/BatterySwitch.cs @@ -235,7 +235,7 @@ public virtual void HandleEvent(PowerSupplyEvent evt) switch (evt) { case PowerSupplyEvent.CloseBatterySwitch: - if (Mode == ModeType.Switch) + if (Mode == ModeType.Switch && !CommandSwitch) { CommandSwitch = true; Wagon.SignalEvent(Event.BatterySwitchCommandOn); @@ -243,7 +243,7 @@ public virtual void HandleEvent(PowerSupplyEvent evt) break; case PowerSupplyEvent.OpenBatterySwitch: - if (Mode == ModeType.Switch) + if (Mode == ModeType.Switch && CommandSwitch) { CommandSwitch = false; Wagon.SignalEvent(Event.BatterySwitchCommandOff); @@ -251,7 +251,7 @@ public virtual void HandleEvent(PowerSupplyEvent evt) break; case PowerSupplyEvent.CloseBatterySwitchButtonPressed: - if (Mode == ModeType.PushButtons) + if (Mode == ModeType.PushButtons && !CommandButtonOn) { CommandButtonOn = true; Wagon.SignalEvent(Event.BatterySwitchCommandOn); @@ -259,7 +259,7 @@ public virtual void HandleEvent(PowerSupplyEvent evt) break; case PowerSupplyEvent.CloseBatterySwitchButtonReleased: - if (Mode == ModeType.PushButtons) + if (Mode == ModeType.PushButtons && CommandButtonOn) { CommandButtonOn = false; Wagon.SignalEvent(Event.BatterySwitchCommandOff); @@ -267,7 +267,7 @@ public virtual void HandleEvent(PowerSupplyEvent evt) break; case PowerSupplyEvent.OpenBatterySwitchButtonPressed: - if (Mode == ModeType.PushButtons) + if (Mode == ModeType.PushButtons && !CommandButtonOff) { CommandButtonOff = true; Wagon.SignalEvent(Event.BatterySwitchCommandOn); @@ -275,7 +275,7 @@ public virtual void HandleEvent(PowerSupplyEvent evt) break; case PowerSupplyEvent.OpenBatterySwitchButtonReleased: - if (Mode == ModeType.PushButtons) + if (Mode == ModeType.PushButtons && CommandButtonOff) { CommandButtonOff = false; Wagon.SignalEvent(Event.BatterySwitchCommandOff);