Skip to content

Commit 71beb33

Browse files
committed
changes Advanced Adhesion label in HUD to yellow when precision method is low
1 parent 8dc3628 commit 71beb33

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

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

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ public float InertiaKgm2
431431
/// <summary>
432432
/// switch between Polach and Pacha adhesion calculation
433433
/// </summary>
434-
bool UsePolachAdhesion = false;
434+
public static bool UsePolachAdhesion = false; // "static" so it's shared by all axles of the Player's loco
435435

436436
/// <summary>
437437
/// Pre-calculation of slip characteristics at 0 slip speed
@@ -1122,22 +1122,25 @@ enum AdhesionPrecisionLevel
11221122
// into HelpWindow.PrepareFrame() temporarily.
11231123
public static bool IsPrecisionHigh(float elapsedSeconds)
11241124
{
1125-
// Switches between Polach (high precision) adhesion model and Pacha (low precision) adhesion model depending upon the PC performance
1126-
switch (PrecisionLevel)
1125+
if (elapsedSeconds > 0) // Ignore period with elapsedSeconds == 0 until user starts game.
11271126
{
1128-
case AdhesionPrecisionLevel.High:
1129-
if (elapsedSeconds > UpperLimitS)
1130-
{
1131-
var screenFrameRate = 1 / elapsedSeconds;
1127+
// Switches between Polach (high precision) adhesion model and Pacha (low precision) adhesion model depending upon the PC performance
1128+
switch (PrecisionLevel)
1129+
{
1130+
case AdhesionPrecisionLevel.High:
1131+
if (elapsedSeconds > UpperLimitS)
11321132
{
1133-
Trace.TraceInformation($"Advanced adhesion model switched to low precision permanently after low frame rate {screenFrameRate:F1} below limit {1 / UpperLimitS:F0}");
1134-
PrecisionLevel = AdhesionPrecisionLevel.Low;
1133+
var screenFrameRate = 1 / elapsedSeconds;
1134+
{
1135+
Trace.TraceInformation($"Advanced adhesion model switched to low precision permanently after low frame rate {screenFrameRate:F1} below limit {1 / UpperLimitS:F0}");
1136+
PrecisionLevel = AdhesionPrecisionLevel.Low;
1137+
}
11351138
}
1136-
}
1137-
break;
1139+
break;
11381140

1139-
case AdhesionPrecisionLevel.Low:
1140-
break;
1141+
case AdhesionPrecisionLevel.Low:
1142+
break;
1143+
}
11411144
}
11421145
return (PrecisionLevel == AdhesionPrecisionLevel.High);
11431146
}

Source/RunActivity/Viewer3D/Popups/HUDWindow.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
using Orts.Simulation.RollingStocks.SubSystems.Brakes;
2828
using Orts.Simulation.RollingStocks.SubSystems.Brakes.MSTS;
2929
using Orts.Simulation.RollingStocks.SubSystems.PowerSupplies;
30+
using Orts.Simulation.RollingStocks.SubSystems.PowerTransmissions;
3031
using Orts.Viewer3D.Processes;
3132
using ORTS.Common;
3233
using ORTS.Scripting.Api;
@@ -1078,7 +1079,9 @@ void TextPageForceInfo(TableData table)
10781079
{
10791080
if (mstsLocomotive.AdvancedAdhesionModel)
10801081
{
1081-
TableAddLine(table, Viewer.Catalog.GetString("(Advanced adhesion model)"));
1082+
var text = Viewer.Catalog.GetString("(Advanced adhesion model)");
1083+
if (Axle.UsePolachAdhesion == false) text += "???";
1084+
TableAddLine(table, text);
10821085
int row0 = table.CurrentRow;
10831086
TableSetCell(table, table.CurrentRow++, table.CurrentLabelColumn, Viewer.Catalog.GetString("Wheel slip (Thres)"));
10841087
TableSetCell(table, table.CurrentRow++, table.CurrentLabelColumn, Viewer.Catalog.GetString("Conditions"));

Source/RunActivity/Viewer3D/Popups/HelpWindow.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,6 +1216,8 @@ public TabData(Tab tab, string tabLabel, Action<ControlLayout> layout)
12161216

12171217
public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
12181218
{
1219+
// Uncomment this statement to reduce framerate during play for testing
1220+
//System.Threading.Thread.Sleep(40); // Press F1 to force framerate below 25 fps
12191221

12201222
base.PrepareFrame(elapsedTime, updateFull);
12211223

0 commit comments

Comments
 (0)