feat(sceneries): a release clears the .sbt files once, and a scenery's menu deletes its own

The simulator makes a scenery's .sbt on its first load and never checks it
against the text again, so an older simulator's file, or one made before a
scenery update, keeps showing the old terrain.

- CleanupGeneration, raised by a release, clears the .sbt files once per
  installation on the first start, ahead of the scenery list. A file goes only
  while its scenery's terrain files (*_ter.scm) are all there and no terrain
  directive brings terrain from elsewhere; an .sbt standing in for missing
  terrain stays, and the log says what is missing. Which cleanup each
  installation had is kept in sbt-cleanup.txt in the user's folder.
- "Delete SBT" in the scenery list's menu does the same for one scenery,
  asking first and refusing where nothing could make the file again.
- The .sbt is among the files a scenery is watched by, so one made or removed
  reaches the list without a reload.
This commit is contained in:
maj00r
2026-11-17 02:15:45 +01:00
parent c07ed2fb4d
commit 797e2e70a7
14 changed files with 504 additions and 1 deletions

View File

@@ -53,6 +53,26 @@ public class SceneryFileWatchTests
Assert.Equal("Katowice Główne", change.Fresh!.Name);
}
[Theory]
[InlineData(true)]
[InlineData(false)]
public void An_sbt_made_or_removed_makes_the_scenery_read_anew(bool there)
{
string sbt = TestInstallation.At("scenery", "kato.sbt");
var files = Folder();
if (there)
files.WithFile(sbt, "EU07SBT2");
var (installation, watch, _) = Rig(files);
if (there)
files.DeleteFile(sbt);
else
files.WithFile(sbt, "EU07SBT2");
var change = Assert.Single(watch.Look(installation.Library.Sceneries));
Assert.Equal(!there, change.Fresh!.HasCompanionTimetable);
}
[Fact]
public void An_include_that_changed_or_came_makes_the_scenery_read_anew()
{