Skip to content

Commit f281de6

Browse files
committed
Fix bug with acceleration
1 parent f6b292d commit f281de6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/CruiseControl.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,12 +1306,12 @@ void IncreaseForce(ref float throttleOrDynPercent, float elapsedClockSeconds, fl
13061306
if (throttleOrDynPercent < 0)
13071307
{
13081308
float step = 100 / DynamicBrakeFullRangeDecreaseTimeSeconds * elapsedClockSeconds;
1309-
CCThrottleOrDynBrakePercent = Math.Min(CCThrottleOrDynBrakePercent + step, Math.Min(maxPercent, 0));
1309+
throttleOrDynPercent = Math.Min(throttleOrDynPercent + step, Math.Min(maxPercent, 0));
13101310
}
13111311
else
13121312
{
13131313
float step = 100 / ThrottleFullRangeIncreaseTimeSeconds * elapsedClockSeconds;
1314-
CCThrottleOrDynBrakePercent = Math.Min(CCThrottleOrDynBrakePercent + step, maxPercent);
1314+
throttleOrDynPercent = Math.Min(throttleOrDynPercent + step, maxPercent);
13151315
}
13161316
}
13171317

@@ -1320,12 +1320,12 @@ void DecreaseForce(ref float throttleOrDynPercent, float elapsedClockSeconds, fl
13201320
if (throttleOrDynPercent > 0)
13211321
{
13221322
float step = 100 / ThrottleFullRangeDecreaseTimeSeconds * elapsedClockSeconds;
1323-
CCThrottleOrDynBrakePercent = Math.Min(CCThrottleOrDynBrakePercent - step, Math.Max(minPercent, 0));
1323+
throttleOrDynPercent = Math.Max(throttleOrDynPercent - step, Math.Max(minPercent, 0));
13241324
}
13251325
else
13261326
{
13271327
float step = 100 / DynamicBrakeFullRangeIncreaseTimeSeconds * elapsedClockSeconds;
1328-
CCThrottleOrDynBrakePercent = Math.Min(CCThrottleOrDynBrakePercent - step, minPercent);
1328+
throttleOrDynPercent = Math.Max(throttleOrDynPercent - step, minPercent);
13291329
}
13301330
}
13311331

0 commit comments

Comments
 (0)