From 53fe9aa48ccd4f2a1787f30e1e9b3b7b7d4a2132 Mon Sep 17 00:00:00 2001 From: maj00r Date: Sun, 4 Oct 2026 18:55:21 +0200 Subject: [PATCH] Explain the greyed-out ready box and count cars in the depot A disabled checkbox shows no tooltip, so the settings override that greys out "ready to go" is now said under it. The consist vehicle count counted units, so a multi-unit was one vehicle; it now counts cars like the stats bar. --- StarterNG.Tests/ConsistTailTests.cs | 11 +++++++++++ StarterNG/Domain/Consist.cs | 3 +++ StarterNG/Views/Depot/VehicleDetails.cs | 13 ++++++++----- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/StarterNG.Tests/ConsistTailTests.cs b/StarterNG.Tests/ConsistTailTests.cs index 8f5345e..1da3fe2 100644 --- a/StarterNG.Tests/ConsistTailTests.cs +++ b/StarterNG.Tests/ConsistTailTests.cs @@ -21,6 +21,17 @@ public class ConsistTailTests _consist = new Consist(_catalog, new VehicleInfo(_catalog, installation.Physics)); } + [Fact] + public void The_vehicle_count_counts_cars_not_units() + { + Append("b111-01"); + var pair = Append("b111-02"); + pair.Cars.Add(pair.Cars[0].Clone()); + + Assert.Equal(2, _consist.Count); + Assert.Equal(3, _consist.VehicleCount); + } + [Fact] public void A_new_last_car_is_left_uncoupled_at_the_back() { diff --git a/StarterNG/Domain/Consist.cs b/StarterNG/Domain/Consist.cs index 80ee73f..2faf0bd 100644 --- a/StarterNG/Domain/Consist.cs +++ b/StarterNG/Domain/Consist.cs @@ -35,6 +35,9 @@ public sealed class Consist : IReadOnlyList public int Count => _items.Count; + /// Every vehicle, a multi-unit counted car by car - counts units. + public int VehicleCount => _items.Sum(i => i.Cars.Count); + public ConsistItem this[int index] { get => _items[index]; diff --git a/StarterNG/Views/Depot/VehicleDetails.cs b/StarterNG/Views/Depot/VehicleDetails.cs index 294b09c..6ee32b7 100644 --- a/StarterNG/Views/Depot/VehicleDetails.cs +++ b/StarterNG/Views/Depot/VehicleDetails.cs @@ -568,7 +568,7 @@ public sealed class VehicleDetails var count = new TextBlock { - Text = $"{App.Loc["VehicleCount"]}: {_consist.Count}", + Text = $"{App.Loc["VehicleCount"]}: {_consist.VehicleCount}", FontSize = 12, Foreground = DimBrush, VerticalAlignment = VerticalAlignment.Center @@ -593,9 +593,7 @@ public sealed class VehicleDetails ? over == ConsistReadyOverride.AlwaysReady : trainset?.ReadyToGo ?? false }; - ToolTip.SetTip(ready, overridden - ? App.Loc["ConsistReadyOverridden"] - : App.Loc["ConsistReadyDesc"]); + ToolTip.SetTip(ready, App.Loc["ConsistReadyDesc"]); ready.IsCheckedChanged += (_, _) => { @@ -605,7 +603,12 @@ public sealed class VehicleDetails _redraw(); }; - return Row(content: ready); + // A disabled box shows no tooltip, so why it is greyed out is said beside it. + if (!overridden) + return Row(content: ready); + var why = PanelNote(App.Loc["ConsistReadyOverridden"]); + why.Margin = new Thickness(0); + return Row(content: new StackPanel { Spacing = 2, Children = { ready, why } }); } private Button LoadToolButton(string text, Action onClick, bool secondary = false)