Skip to content

Commit 8d79762

Browse files
committed
Automatic merge of T1.6-rc2-26-g74ecafa7f and 10 pull requests
- Pull request #1072 at 076a8d3: Content Creation Shortcuts & Advanced Wagon Shape Interactions - Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc) - Pull request #1091 at 520ac64: Automatic speed control - Pull request #1097 at 63248a0: Fix For Delayed Particle Emitter Spawning - Pull request #1099 at 5e8b056: Fix TCS orders not being sent to pantographs - Pull request #1100 at cccb40a: Updates to German translations - Pull request #1102 at c96c499: Fix Stuck Locomotive Brakes After Initialization - Pull request #1103 at d2fae0f: Fix diverging force when exceeding max speed - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1081 at 689494b: Brake cuts power unification
12 parents 7a3c94a + 74ecafa + 076a8d3 + e10390b + 520ac64 + 63248a0 + 5e8b056 + cccb40a + c96c499 + d2fae0f + 5845a1a + 689494b commit 8d79762

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public CruiseControl(CruiseControl other, MSTSLocomotive locomotive)
252252
SpeedRegulatorOptions = other.SpeedRegulatorOptions;
253253
CruiseControlLogic = other.CruiseControlLogic;
254254
SpeedDeltaFunctionMode = other.SpeedDeltaFunctionMode;
255-
SpeedRegulatorNominalSpeedStepMpS = other.SpeedRegulatorNominalSpeedStepMpS;
255+
SelectedSpeedPrecisionMpS = other.SelectedSpeedPrecisionMpS;
256256
MaxAccelerationMpSS = other.MaxAccelerationMpSS;
257257
MaxDecelerationMpSS = other.MaxDecelerationMpSS;
258258
StartReducingSpeedDelta = other.StartReducingSpeedDelta;
@@ -1541,7 +1541,12 @@ protected float ControllerValueToSelectedSpeedMpS(float val)
15411541
return 0;
15421542
float min = MinimumSpeedForCCEffectMpS;
15431543
float max = Locomotive.MaxSpeedMpS;
1544-
return val * (max - min) + min;
1544+
float speed = val * (max - min) + min;
1545+
if (SpeedSelectorIsDiscrete && SpeedRegulatorNominalSpeedStepMpS > 0)
1546+
{
1547+
speed = (int)(speed / SpeedRegulatorNominalSpeedStepMpS) * SpeedRegulatorNominalSpeedStepMpS;
1548+
}
1549+
return speed;
15451550
}
15461551

15471552
public string GetCruiseControlStatus()

0 commit comments

Comments
 (0)