From c3a572a41a525c1ad4f8f9f820836b3b3146a90f Mon Sep 17 00:00:00 2001 From: peternewell Date: Sun, 7 Jan 2024 08:09:46 +1100 Subject: [PATCH] Correct a bug in Control Car --- .../Simulation/RollingStocks/MSTSControlTrailerCar.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Orts.Simulation/Simulation/RollingStocks/MSTSControlTrailerCar.cs b/Source/Orts.Simulation/Simulation/RollingStocks/MSTSControlTrailerCar.cs index 611842aad..eb541240b 100644 --- a/Source/Orts.Simulation/Simulation/RollingStocks/MSTSControlTrailerCar.cs +++ b/Source/Orts.Simulation/Simulation/RollingStocks/MSTSControlTrailerCar.cs @@ -41,7 +41,7 @@ namespace Orts.Simulation.RollingStocks { public class MSTSControlTrailerCar : MSTSLocomotive { - public int ControllerNumberOfGears = 1; + public int ControllerNumberOfGears = 0; bool HasGearController = false; bool ControlGearUp = false; bool ControlGearDown = false; @@ -174,7 +174,7 @@ public override void Update(float elapsedClockSeconds) { var locog = car as MSTSDieselLocomotive; - if (locog != null && car != this && !locog.IsLeadLocomotive() && (ControlGearDown || ControlGearUp)) + if (locog != null && locog.DieselEngines[0].GearBox != null && locog.DieselEngines[0].GearBox != null && car != this && !locog.IsLeadLocomotive() && (ControlGearDown || ControlGearUp)) { if (ControlGearUp) { @@ -194,7 +194,7 @@ public override void Update(float elapsedClockSeconds) } // Read values for the HuD and other requirements, will be based upon the last motorcar - if (locog != null) + if (locog != null && locog.DieselEngines[0].GearBox != null && locog.DieselEngines[0].GearBox != null) { ControlGearIndex = locog.DieselEngines[0].GearBox.CurrentGearIndex; ControlGearIndication = locog.DieselEngines[0].GearBox.GearIndication;