Black box: the queries of the user's train worked out once a read, lights as the driver checks them

- The stations, the signals passed, the horn points, the couplings, the
  consists and the timetable progress of the user's train are kept until
  a read adds something; the views asked for them every frame, which on
  a long session with many trains took the window down. A read that adds
  nothing no longer counts as a change.
- The lights are checked against the lamps the vehicles at the ends have
  (written by the simulator from now on), as its driver checks them: Pc 1
  without the upper headlight, with the auxiliary lamps, Pc 5 with the
  rear-end signals. Only while the user drives: the autopilot's lights
  are its own.
- A train off the platform counts at both ends: its head past the stop
  point as well as its tail before the platform's end.
- A recording without the couplings keeps the timetable for any vehicle
  of the user.
- A signal passed at danger is ringed on the map only once it was.
- In the tapes window a black box opens on a click or Enter, not when
  the arrow keys go over it.
- The viewer's screenshot of a window not laid out saves nothing and
  still closes.
This commit is contained in:
maj00r
2026-11-11 00:57:57 +01:00
parent e530b95352
commit 532875fc7b
14 changed files with 254 additions and 52 deletions

View File

@@ -148,7 +148,7 @@ public sealed class DefaultBlackBoxStrings : IBlackBoxStrings
["TtStopPast"] = "{0:0.0} m past",
["TtStopExact"] = "on the spot",
["TtOnPlatform"] = "along the platform",
["TtOffPlatform"] = "the tail {0:0.0} m off the platform",
["TtOffPlatform"] = "{0:0.0} m of the train off the platform",
["TtTechnical"] = "technical stop",
["TtStanding"] = "standing",
["EventStopped"] = "Stop at {0}, {1}",
@@ -347,7 +347,7 @@ public sealed class DefaultBlackBoxStrings : IBlackBoxStrings
["TtStopPast"] = "{0:0.0} m za miejscem",
["TtStopExact"] = "w punkt",
["TtOnPlatform"] = "cały przy peronie",
["TtOffPlatform"] = "koniec składu {0:0.0} m poza peronem",
["TtOffPlatform"] = "{0:0.0} m składu poza peronem",
["TtTechnical"] = "postój techniczny",
["TtStanding"] = "stoi",
["EventStopped"] = "Postój: {0}, {1}",

View File

@@ -130,19 +130,20 @@ public sealed class CabPanel : Control
double lightsX = Pad + 3 * third + 4;
context.DrawText(MapView.Text(Strings["CabLights"], Palette.DimText, 10), new Point(lightsX, top));
double faceX = lightsX;
foreach (var (key, lights, required) in new[]
foreach (var (key, lights, required, right) in new[]
{
("CabLightsHead", s.LightsHead, HeadCodes.RequiredHead(s)),
("CabLightsTail", s.LightsTail, HeadCodes.RequiredTail(s))
("CabLightsHead", s.LightsHead, HeadCodes.RequiredHead(s), HeadCodes.HeadRight(s)),
("CabLightsTail", s.LightsTail, HeadCodes.RequiredTail(s), HeadCodes.TailRight(s))
})
{
DrawFace(context, lights, new Point(faceX + 18, top + 24));
// the end, and the signal it shows: green as it is to be, red otherwise with the one it is to show
// the end, and the signal it shows: green as it is to be (with the lamps the vehicle has), red otherwise
// with the one it is to show
var shown = HeadCodes.Of(lights);
var text = required is { } want && want != shown
var text = right == false && required is { } want
? $"{HeadCodes.Name(shown)} ≠ {HeadCodes.Name(want)}"
: HeadCodes.Name(shown);
var brush = required is null ? Palette.FaintText : required == shown ? Palette.Good : Palette.Bad;
: right == true && required is { } met ? HeadCodes.Name(met) : HeadCodes.Name(shown);
var brush = right is null ? Palette.FaintText : right.Value ? Palette.Good : Palette.Bad;
var label = MapView.Text($"{Strings[key]} {text}", brush, 9);
context.DrawText(label, new Point(faceX + 18 - label.Width / 2, top + 34));
faceX += 62;

View File

@@ -456,12 +456,14 @@ public sealed class MapView : Control
var danger = new Pen(Palette.Over, 2.5);
foreach (var passing in recording.UserPassings())
{
if (passing.Time > _time)
continue;
var p = ToScreen(passing.Position.X, passing.Position.Z);
if (!Visible(p))
continue;
if (passing.AtDanger)
context.DrawEllipse(null, danger, p, 10, 10);
else if (passing.Time <= _time)
else
context.DrawEllipse(null, passed, p, 7, 7);
}
}