Skip to content

Commit 3caecc7

Browse files
committed
Minor change in handling of ORTSTrackSuperElevation, add SuperElev column to debug display
1 parent 8b2d4ca commit 3caecc7

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

Source/ORTS.Common/Conversions.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,13 @@ public static string FormatVeryShortDistanceDisplay(float distanceM, bool isMetr
682682
return String.Format(CultureInfo.CurrentCulture, "{0:N3} {1}", Me.ToFt(distanceM), ft);
683683
}
684684

685+
public static string FormatMillimeterDistanceDisplay(float distanceM, bool isMetric)
686+
{
687+
if (isMetric)
688+
return String.Format(CultureInfo.CurrentCulture, "{0:N0} {1}", distanceM * 1000.0f, mm);
689+
return String.Format(CultureInfo.CurrentCulture, "{0:N1} {1}", Me.ToIn(distanceM), "in");
690+
}
691+
685692
/// <summary>
686693
/// format localized mass string, as displayed in in-game windows.
687694
/// </summary>

Source/Orts.Formats.Msts/RouteFile.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public Tr_RouteFile(STFReader stf)
106106
// values for superelevation
107107
new STFReader.TokenProcessor("ortstracksuperelevation", ()=>{ SuperElevationHgtpRadiusM = new Interpolator(stf); }),
108108
// New superelevation standard, will overwrite ORTSTrackSuperElevation
109-
new STFReader.TokenProcessor("ortssuperelevation", ()=>{ SuperElevationHgtpRadiusM = null; SuperElevation.Add(new SuperElevationStandard(stf)); }),
109+
new STFReader.TokenProcessor("ortssuperelevation", ()=>{ SuperElevation.Add(new SuperElevationStandard(stf)); }),
110110
// images
111111
new STFReader.TokenProcessor("graphic", ()=>{ Thumbnail = stf.ReadStringBlock(null); }),
112112
new STFReader.TokenProcessor("loadingscreen", ()=>{ LoadingScreen = stf.ReadStringBlock(null); }),
@@ -132,6 +132,7 @@ public Tr_RouteFile(STFReader stf)
132132
if (RouteStart == null) throw new STFException(stf, "Missing RouteStart");
133133
if (ForestClearDistance == 0 && RemoveForestTreesFromRoads) Trace.TraceWarning("You must define also ORTSUserPreferenceForestClearDistance to avoid trees on roads");
134134
if (SuperElevation.Count <= 0) SuperElevation.Add(new SuperElevationStandard());
135+
else SuperElevationHgtpRadiusM = null; // Disable legacy superelevation system if newer system is defined
135136
}
136137

137138
public string RouteID; // ie JAPAN1 - used for TRK file and route folder name

Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ public Direction Direction
636636
protected float TrackGaugeM = 1.435f; // Track gauge - read in MSTSWagon
637637
protected Vector3 InitialCentreOfGravityM = new Vector3(0, 1.8f, 0); // get centre of gravity - read in MSTSWagon
638638
protected Vector3 CentreOfGravityM = new Vector3(0, 1.8f, 0); // get centre of gravity after adjusted for freight animation
639-
protected float SuperelevationM; // Super elevation on the curve
639+
public float SuperelevationM; // Super elevation on the curve
640640
protected float MaxUnbalancedSuperElevationM; // Maximum comfortable cant deficiency, read from MSTS Wagon File
641641
public float SuperElevationAngleRad;
642642
protected bool IsMaxSafeCurveSpeed = false; // Has equal loading speed around the curve been exceeded, ie are all the wheesl still on the track?

Source/RunActivity/Viewer3D/Popups/HUDWindow.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,12 +1234,13 @@ void TextPageForceInfo(TableData table)
12341234
Viewer.Catalog.GetString("Mass"),
12351235
Viewer.Catalog.GetString("Gradient"),
12361236
Viewer.Catalog.GetString("Curve"),
1237+
Viewer.Catalog.GetString("SuperElev"),
12371238
Viewer.Catalog.GetString("Brk Frict."),
12381239
Viewer.Catalog.GetString("Brk Slide"),
12391240
Viewer.Catalog.GetString("Bear Temp"),
12401241
Viewer.Catalog.GetString(" "),
1241-
Viewer.Catalog.GetString("DerailCoeff")
1242-
1242+
Viewer.Catalog.GetString("DerailCoeff"),
1243+
Viewer.Catalog.GetString(" ")
12431244
);
12441245
TableAddLine(table);
12451246

@@ -1263,11 +1264,13 @@ void TextPageForceInfo(TableData table)
12631264
TableSetCell(table, 12, "{0}", FormatStrings.FormatLargeMass(car.MassKG, car.IsMetric, car.IsUK));
12641265
TableSetCell(table, 13, "{0:F2}%", -car.CurrentElevationPercent);
12651266
TableSetCell(table, 14, "{0}", FormatStrings.FormatDistance(car.CurrentCurveRadiusM, car.IsMetric));
1266-
TableSetCell(table, 15, "{0:F0}%", car.HuDBrakeShoeFriction * 100.0f);
1267-
TableSetCell(table, 16, car.HUDBrakeSkid ? Viewer.Catalog.GetString("Yes") : Viewer.Catalog.GetString("No"));
1268-
TableSetCell(table, 17, "{0} {1}", FormatStrings.FormatTemperature(car.WheelBearingTemperatureDegC, car.IsMetric, false), car.DisplayWheelBearingTemperatureStatus);
1269-
TableSetCell(table, 18, car.Flipped ? Viewer.Catalog.GetString("Flipped") : "");
1270-
TableSetCell(table, 19, "{0:F2}{1}", car.DerailmentCoefficient, car.DerailExpected ? "!!!" : car.DerailPossible ? "???" : "");
1267+
TableSetCell(table, 15, "{0}", FormatStrings.FormatMillimeterDistanceDisplay(car.SuperelevationM, car.IsMetric));
1268+
TableSetCell(table, 16, "{0:F0}%", car.HuDBrakeShoeFriction * 100.0f);
1269+
TableSetCell(table, 17, car.HUDBrakeSkid ? Viewer.Catalog.GetString("Yes") : Viewer.Catalog.GetString("No"));
1270+
TableSetCell(table, 18, "{0} {1}", FormatStrings.FormatTemperature(car.WheelBearingTemperatureDegC, car.IsMetric, false), car.DisplayWheelBearingTemperatureStatus);
1271+
TableSetCell(table, 19, " ");
1272+
TableSetCell(table, 20, "{0:F2}{1}", car.DerailmentCoefficient, car.DerailExpected ? "!!!" : car.DerailPossible ? "???" : "");
1273+
TableSetCell(table, 21, car.Flipped ? Viewer.Catalog.GetString("Flipped") : "");
12711274
TableAddLine(table);
12721275

12731276
}

0 commit comments

Comments
 (0)