File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -801,7 +801,7 @@ public float LoadPercent
801801 {
802802 get
803803 {
804- return ( CurrentDieselOutputPowerW <= 0f ? 0f : ( ( OutputPowerW + Locomotive . LocomotivePowerSupply . ElectricTrainSupplyPowerW / Locomotive . DieselEngines . NumOfActiveEngines ) * 100f / CurrentDieselOutputPowerW ) ) ;
804+ return CurrentDieselOutputPowerW <= 0f ? 0f : ( ( OutputPowerW + ( Locomotive . DieselEngines . NumOfActiveEngines > 0 ? Locomotive . LocomotivePowerSupply . ElectricTrainSupplyPowerW / Locomotive . DieselEngines . NumOfActiveEngines : 0f ) ) * 100f / CurrentDieselOutputPowerW ) ;
805805 }
806806 }
807807 /// <summary>
@@ -1034,8 +1034,11 @@ public void Update(float elapsedClockSeconds)
10341034 CurrentDieselOutputPowerW = ( RealRPM - IdleRPM ) / ( MaxRPM - IdleRPM ) * MaximumDieselPowerW * ( 1 - Locomotive . PowerReduction ) ;
10351035 }
10361036
1037- CurrentDieselOutputPowerW -= Locomotive . DieselPowerSupply . ElectricTrainSupplyPowerW / Locomotive . DieselEngines . NumOfActiveEngines ;
1038- CurrentDieselOutputPowerW = CurrentDieselOutputPowerW < 0f ? 0f : CurrentDieselOutputPowerW ;
1037+ if ( Locomotive . DieselEngines . NumOfActiveEngines > 0 )
1038+ {
1039+ CurrentDieselOutputPowerW -= Locomotive . DieselPowerSupply . ElectricTrainSupplyPowerW / Locomotive . DieselEngines . NumOfActiveEngines ;
1040+ CurrentDieselOutputPowerW = CurrentDieselOutputPowerW < 0f ? 0f : CurrentDieselOutputPowerW ;
1041+ }
10391042
10401043 if ( State == DieselEngineState . Starting )
10411044 {
You can’t perform that action at this time.
0 commit comments