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
801
801
{
802
802
get
803
803
{
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 ) ;
805
805
}
806
806
}
807
807
/// <summary>
@@ -1034,8 +1034,11 @@ public void Update(float elapsedClockSeconds)
1034
1034
CurrentDieselOutputPowerW = ( RealRPM - IdleRPM ) / ( MaxRPM - IdleRPM ) * MaximumDieselPowerW * ( 1 - Locomotive . PowerReduction ) ;
1035
1035
}
1036
1036
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
+ }
1039
1042
1040
1043
if ( State == DieselEngineState . Starting )
1041
1044
{
You can’t perform that action at this time.
0 commit comments