fix(tapes): a tape followed live reads only what was added, and a stall, a shared black box or a gap are told right

At a higher time speed the simulator's log grows many times faster, and the
live view read and split the whole file every two seconds. A followed tape now
keeps its reader and reads only the bytes added; one begun anew (shorter, its
end no longer what was read, or its time going back) is read whole.

From the review: a gap is over two seconds, above the frame the simulator
holds to a second, so a stall is driving or standing; a black box's time ends
by the start of the next one, as a downloaded one was last written later; the
summary shows what was recorded and what wasn't, and the trace breaks off at
a gap; the cab panel's wheels compare signed speeds and stay clear of the
gauges; each box's name is parsed once per listing.
This commit is contained in:
maj00r
2026-11-15 23:34:53 +01:00
parent 7823bb8d09
commit 06513537f0
12 changed files with 315 additions and 54 deletions

View File

@@ -95,11 +95,16 @@ public sealed class CabPanel : Control
context.DrawText(speed, new Point(Pad, 24));
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);
// the wheels, when they turn otherwise: slipping, or locked in a skid. Signed both, so wheels slipping ahead
// of a train rolling back show too. Kept off the gauges at the right, as the AI's line is.
if (s.WheelSpeedKmh is { } wheels && Math.Abs(wheels - s.SpeedKmh) >= WheelsApartKmh)
{
double wheelsX = Pad + speed.Width + 4 + unit.Width + 8;
using (context.PushClip(new Rect(wheelsX, 24, Math.Max(0, gaugeX - 8 - wheelsX), 40)))
context.DrawText(MapView.Text(string.Format(culture, Strings["CabWheels"], Math.Abs(wheels)), Palette.Warn, 12),
new Point(wheelsX, 24 + speed.Height - 21));
}
if (s.AiValid)
{
using (context.PushClip(new Rect(Pad, 76, gaugeX - Pad - 8, 40)))