File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Source/Orts.Simulation/Simulation/RollingStocks/SubSystems Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff 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 ( )
You can’t perform that action at this time.
0 commit comments