feat(settings): a standard mode as the old starter's panel, the rest behind a warning

The settings keep only the keys master reads, Vulkan left out. The standard
mode is the old starter's panel; the advanced mode opens behind a warning
whose yes takes a click only after 20 seconds in front of the player.

- Sliders go by fixed steps (SliderRanges), held to the standard ranges there:
  fpslimit up to 240, sleeperdistance up to 1000 m.
- On the first start everyone is moved to the standard mode once: what is
  outside it goes back to its default, the sliders' values to their ranges,
  and a copy of eu07.ini is kept as eu07.ini.before-standard.
- "Restore defaults" puts every setting back, the language, the simulator,
  the UART port and the control keys kept.
- Monitors and renderers are found anew (Monitors, Renderers), Displays and
  SettingReach gone.
- mousescale writes its second number as the old starter did, 0.5 or -0.5
  for an inverted vertical axis; an axis that would not move gets the default.
- Depot, in the standard mode: no AI or drivable-only filters, empty consists
  not listed, the crew shown but not changed.
- Randomizing the textures of a whole scenery no longer rebuilds the view per
  consist, and finds its candidates by mini, so the window keeps answering.
- A long operator in the vehicle list is cut short instead of over the name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maj00r
2026-11-22 00:02:29 +01:00
parent de943cf461
commit 93f914c868
49 changed files with 2502 additions and 3514 deletions

View File

@@ -1,5 +1,6 @@
using StarterNG.Classes;
using StarterNG.Domain;
using StarterNG.Domain.Settings;
using StarterNG.Views;
namespace StarterNG.Tests;
@@ -58,6 +59,63 @@ public class TrainsetDisplayTests
Assert.False(TrainsetDisplay.ListedIn(picked, showAi: false, drivableOnly: true, current: picked));
}
private static SimulatorSettings Mode(bool advanced) =>
new() { AdvancedSettings = advanced, ShowAiVehicles = true, DrivableOnly = false };
[Fact]
public void The_standard_mode_lists_every_consist_but_starts_only_in_one_a_player_drives()
{
var standard = Mode(advanced: false);
var decor = new Trainset("trainset a tor 0 0 //$decor\nnode -1 0 v1 dynamic d s m 0 headdriver 3 0 enddynamic\nendtrainset");
Assert.True(decor.Decor);
foreach (var consist in new[] { Consist(), Consist(description: "-ai"), Consist(driver: "nobody"), decor })
Assert.True(TrainsetDisplay.ListedIn(consist, standard, current: null));
Assert.True(TrainsetDisplay.StartableIn(Consist(), standard));
Assert.True(TrainsetDisplay.StartableIn(Consist(driver: "nobody"), standard));
Assert.False(TrainsetDisplay.StartableIn(Consist(description: "-ai"), standard));
Assert.False(TrainsetDisplay.StartableIn(decor, standard));
Assert.True(TrainsetDisplay.StartableIn(decor, Mode(advanced: true)));
}
[Fact]
public void The_filters_work_in_the_advanced_mode()
{
var settings = Mode(advanced: true);
settings.ShowAiVehicles = false;
Assert.False(TrainsetDisplay.ListedIn(Consist(description: "-ai"), settings, current: null));
Assert.True(TrainsetDisplay.ListedIn(Consist(), settings, current: null));
settings.DrivableOnly = true;
Assert.False(TrainsetDisplay.ListedIn(Consist(driver: "nobody"), settings, current: null));
}
[Fact]
public void The_standard_mode_has_no_filters_and_leaves_out_empty_consists()
{
var standard = new SimulatorSettings { AdvancedSettings = false, ShowAiVehicles = false, DrivableOnly = true };
var empty = new Trainset("trainset a tor 0 0\nendtrainset");
Assert.True(TrainsetDisplay.ListedIn(Consist(description: "-ai"), standard, current: null));
Assert.True(TrainsetDisplay.ListedIn(Consist(driver: "nobody"), standard, current: null));
Assert.False(TrainsetDisplay.ListedIn(empty, standard, current: null));
Assert.False(TrainsetDisplay.ListedIn(empty, standard, current: empty));
}
[Fact]
public void The_advanced_mode_lists_by_its_own_filters()
{
var advanced = Mode(advanced: true);
Assert.True(TrainsetDisplay.ListedIn(Consist(description: "-ai"), advanced, current: null));
Assert.True(TrainsetDisplay.ListedIn(Consist(driver: "nobody"), advanced, current: null));
advanced.ShowAiVehicles = false;
Assert.False(TrainsetDisplay.ListedIn(Consist(description: "-ai"), advanced, current: null));
}
[Theory]
[InlineData(eDriverType.Headdriver, 0)]
[InlineData(eDriverType.Reardriver, 1)]