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

@@ -19,6 +19,9 @@ public sealed class ConfigFile
// Its first line, or -1 when the file runs to its end.
private int _end = -1;
// While lines are indexed: the one at hand starts inside a block comment.
private bool _inBlock;
public static ConfigFile Parse(string text)
{
var cfg = new ConfigFile();
@@ -37,7 +40,10 @@ public sealed class ConfigFile
private void IndexLine(int line)
{
if (!TryParseKey(_lines[line], out string key))
// The simulator skips what /* */ encloses, over as many lines as it runs.
bool startsInBlock = _inBlock;
_inBlock = EndsInBlock(_lines[line], startsInBlock);
if (startsInBlock || !TryParseKey(_lines[line], out string key))
return;
if (_end < 0 && key.Equals(EndKey, StringComparison.OrdinalIgnoreCase))
@@ -52,6 +58,7 @@ public sealed class ConfigFile
{
_index.Clear();
_end = -1;
_inBlock = false;
for (int line = 0; line < _lines.Count; line++)
IndexLine(line);
}
@@ -252,17 +259,53 @@ public sealed class ConfigFile
}
}
// Where a comment starts as the simulator's parser sees one: // or /* anywhere, even glued
// to a value, but not within quotes, which it keeps whole.
private static int FindCommentStart(string body)
{
for (int i = 0; i + 1 < body.Length; i++)
bool quoted = false;
for (int i = 0; i < body.Length; i++)
{
if (body[i] == '/' && body[i + 1] == '/' &&
(i == 0 || char.IsWhiteSpace(body[i - 1])))
if (body[i] == '"')
quoted = !quoted;
else if (!quoted && i + 1 < body.Length && body[i] == '/' && body[i + 1] is '/' or '*')
return i;
}
return -1;
}
// Whether a block comment is still open at the end of the line.
private static bool EndsInBlock(string raw, bool inBlock)
{
bool quoted = false;
for (int i = 0; i < raw.Length; i++)
{
if (inBlock)
{
if (raw[i] == '*' && i + 1 < raw.Length && raw[i + 1] == '/')
{
inBlock = false;
i++;
}
continue;
}
if (raw[i] == '"')
quoted = !quoted;
else if (!quoted && raw[i] == '/' && i + 1 < raw.Length)
{
if (raw[i + 1] == '/')
return false;
if (raw[i + 1] == '*')
{
inBlock = true;
i++;
}
}
}
return inBlock;
}
private static int IndexOfWhitespace(string s)
{
for (int i = 0; i < s.Length; i++)