Skip to content

Commit 1b1fab5

Browse files
committed
Automatic merge of T1.5.1-684-gc6e0de1c4 and 9 pull requests
- Pull request #570 at c59c788: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #865 at 67014b7: Dispatcher window improvements - Pull request #874 at f8dbeab: Dynamic brake controller refactoring - Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #878 at 89a0f99: Implement Polach Adhesion - Pull request #882 at e92be5a: Blueprint/train car operations UI window - Pull request #883 at aac4d3f: SwitchPanel disconnect/connect handling
11 parents 046b292 + c6e0de1 + c59c788 + d00beb9 + 67014b7 + f8dbeab + 43bf33e + f92de76 + 89a0f99 + e92be5a + aac4d3f commit 1b1fab5

File tree

1 file changed

+14
-12
lines changed
  • Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions

1 file changed

+14
-12
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions/Axle.cs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -875,27 +875,29 @@ void Integrate(float elapsedClockSeconds)
875875
if (elapsedClockSeconds <= 0) return;
876876
double prevSpeedMpS = AxleSpeedMpS;
877877

878-
var upperSubStepStartingLimit = 120;
879-
var upperSubStepLimit = upperSubStepStartingLimit;
880-
var lowerSubStepLimit = 1;
878+
float upperSubStepStartingLimit = 120;
879+
float tempupperSubStepLimit = upperSubStepStartingLimit;
880+
float lowerSubStepLimit = 1;
881881

882-
var screenFrameUpperLimit = 60;
883-
var screenFrameLowerLimit = 40;
882+
float screenFrameUpperLimit = 60;
883+
float screenFrameLowerLimit = 40;
884884

885885
// Reduces the number of substeps if screen FPS drops
886-
if (ScreenFrameRate >= screenFrameUpperLimit)
886+
if ( (int)ScreenFrameRate >= screenFrameUpperLimit) // Screen FPS > 60, hold substeps @ maximum value
887887
{
888-
upperSubStepLimit = upperSubStepStartingLimit;
888+
tempupperSubStepLimit = upperSubStepStartingLimit;
889889
}
890-
else if (ScreenFrameRate < screenFrameLowerLimit)
890+
else if ((int)ScreenFrameRate < screenFrameLowerLimit) // Screen FPS < 40, hold substeps @ minimum value
891891
{
892-
upperSubStepLimit = upperSubStepStartingLimit * (screenFrameLowerLimit / screenFrameUpperLimit);
892+
tempupperSubStepLimit = upperSubStepStartingLimit * (screenFrameLowerLimit / screenFrameUpperLimit);
893893
}
894894
else
895895
{
896-
upperSubStepLimit = (int) ((ScreenFrameRate / 60) * upperSubStepStartingLimit);
896+
tempupperSubStepLimit = (int) ((ScreenFrameRate / 60) * upperSubStepStartingLimit);
897897
}
898898

899+
var upperSubStepLimit = tempupperSubStepLimit;
900+
899901
// use straight line graph approximation to increase substeps as slipspeed increases towards the threshold speed point
900902
// Points are 1 = (0, upperLimit) and 2 = (threshold, lowerLimit)
901903
var AdhesGrad = ((upperSubStepLimit - lowerSubStepLimit) / (WheelSlipThresholdMpS - 0));
@@ -933,10 +935,10 @@ void Integrate(float elapsedClockSeconds)
933935
}
934936

935937
if (NumOfSubstepsPS < lowerSubStepLimit)
936-
NumOfSubstepsPS = lowerSubStepLimit;
938+
NumOfSubstepsPS = (int)lowerSubStepLimit;
937939

938940
if (NumOfSubstepsPS > upperSubStepLimit)
939-
NumOfSubstepsPS = upperSubStepLimit;
941+
NumOfSubstepsPS = (int)upperSubStepLimit;
940942

941943
double dt = elapsedClockSeconds / NumOfSubstepsPS;
942944
double hdt = dt / 2;

0 commit comments

Comments
 (0)