feat(blackbox): the speed of the wheels read from the cab record, shown when they slip or skid

The simulator adds the speed of the wheels at the end of the cab record. It is read when there, and the cab
panel shows it next to the vehicle's speed when the two are a km/h apart or more: the wheels slipping, or
locked in a skid.
This commit is contained in:
maj00r
2026-11-14 00:50:03 +01:00
parent 1398545ff2
commit 7823bb8d09
6 changed files with 35 additions and 3 deletions

View File

@@ -183,6 +183,7 @@ public sealed class DefaultBlackBoxStrings : IBlackBoxStrings
["EventSecurityBraking"] = "BRAKING BY {0}",
["EventTimetable"] = "Timetable {0}, {1}",
["CabSpeed"] = "Speed",
["CabWheels"] = "wheels {0:0}",
["CabAiTarget"] = "AI {0:0} km/h",
["CabAcceleration"] = "Along",
["CabLateral"] = "Lateral",
@@ -454,6 +455,7 @@ public sealed class DefaultBlackBoxStrings : IBlackBoxStrings
["EventSecurityBraking"] = "HAMOWANIE PRZEZ {0}",
["EventTimetable"] = "Rozkład {0}, {1}",
["CabSpeed"] = "Prędkość",
["CabWheels"] = "koła {0:0}",
["CabAiTarget"] = "AI {0:0} km/h",
["CabAcceleration"] = "Wzdłużne",
["CabLateral"] = "Boczne",

View File

@@ -22,6 +22,7 @@ public sealed class CabPanel : Control
private const double LampRow = 14;
private const int DoorColumns = 2;
private const double DriveRow = 34;
private const double WheelsApartKmh = 1.0; // the wheels shown when they turn this much faster or slower
private Recording? _recording;
private double _time;
@@ -92,7 +93,12 @@ public sealed class CabPanel : Control
var speed = MapView.Text(s.AbsSpeedKmh.ToString("0", culture), judgement is SpeedJudgement.Over ? Palette.Bad
: judgement is SpeedJudgement.Slightly ? Palette.Warn : Palette.Text, 36, FontWeight.SemiBold);
context.DrawText(speed, new Point(Pad, 24));
context.DrawText(MapView.Text("km/h", Palette.DimText, 12), new Point(Pad + speed.Width + 4, 24 + speed.Height - 21));
var unit = MapView.Text("km/h", Palette.DimText, 12);
context.DrawText(unit, new Point(Pad + speed.Width + 4, 24 + speed.Height - 21));
// the wheels, when they turn otherwise: slipping, or locked in a skid
if (s.WheelSpeedKmh is { } wheels && Math.Abs(Math.Abs(wheels) - s.AbsSpeedKmh) >= WheelsApartKmh)
context.DrawText(MapView.Text(string.Format(culture, Strings["CabWheels"], Math.Abs(wheels)), Palette.Warn, 12),
new Point(Pad + speed.Width + 4 + unit.Width + 8, 24 + speed.Height - 21));
double gaugeX = Pad + Math.Max(150, width * 0.42);
if (s.AiValid)
{