fix(scenery): a vehicle without its .fiz is a fault, an include ending the file is read

A vehicle whose .fiz is not in its folder under dynamic is left out by the
simulator, so its trainset runs short: the scenery check now names the
missing file. An include that is the last thing in the file, with no end,
is inlined as the simulator reads it, and still reported as not closed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maj00r
2026-11-22 00:02:20 +01:00
parent ecf3067d85
commit e63aa71bf8
6 changed files with 135 additions and 13 deletions

View File

@@ -24,7 +24,12 @@ public sealed class SceneryParser
/// Whether the simulator opens an include, as the include names it; null leaves
/// includes unchecked.
/// </param>
public Scenery Parse(string path, string content, Func<string, bool>? opensInclude = null)
/// <param name="loadsVehicle">
/// Whether the simulator finds a vehicle's .fiz, by its folder and .mmd name as
/// written; null leaves vehicles unchecked.
/// </param>
public Scenery Parse(string path, string content, Func<string, bool>? opensInclude = null,
Func<string, string, bool>? loadsVehicle = null)
{
string original = content;
@@ -38,7 +43,7 @@ public sealed class SceneryParser
// Read from the text with its optional includes blanked, which keeps every
// place where it was, so a fault's line is the line in the file.
var syntax = ScenerySyntax.Scan(content, System.IO.Path.GetFileName(path), opensInclude);
var syntax = ScenerySyntax.Scan(content, System.IO.Path.GetFileName(path), opensInclude, loadsVehicle);
var faults = syntax.Faults.ToList();
var inlined = SceneryIncludes.Ranges(content);