diff --git a/StarterNG.Tests/SettingsStoreTests.cs b/StarterNG.Tests/SettingsStoreTests.cs
index d07fcff..5edc3e8 100644
--- a/StarterNG.Tests/SettingsStoreTests.cs
+++ b/StarterNG.Tests/SettingsStoreTests.cs
@@ -1304,9 +1304,9 @@ public class SettingsStoreTests
}
[Theory]
- [InlineData("physicslog yes\n", true)]
+ [InlineData("starter.physicslog.moved yes\nphysicslog yes\n", true)]
[InlineData("physicslog no\n", false)]
- [InlineData("physicslog yes\nblackbox no\n", false)]
+ [InlineData("starter.physicslog.moved yes\nphysicslog yes\nblackbox no\n", false)]
[InlineData("physicslog no\nblackbox yes\n", true)]
public void The_black_box_goes_with_the_physics_log_unless_the_ini_says_otherwise(string ini, bool recorded)
{
@@ -1333,7 +1333,7 @@ public class SettingsStoreTests
[Fact]
public void A_black_box_that_says_no_more_than_the_physics_log_adds_no_line()
{
- var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, "physicslog yes\n"));
+ var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, "starter.physicslog.moved yes\nphysicslog yes\n"));
installation.SettingsStore.Load();
installation.SettingsStore.Settings.Width = 1600;
@@ -1343,7 +1343,7 @@ public class SettingsStoreTests
}
[Theory]
- [InlineData("physicslog yes\nblackbox yes\n")]
+ [InlineData("starter.physicslog.moved yes\nphysicslog yes\nblackbox yes\n")]
[InlineData("physicslog no\nblackbox yes\n")]
public void A_black_box_line_of_the_file_says_no_once_the_box_is_off(string ini)
{
@@ -1362,7 +1362,7 @@ public class SettingsStoreTests
public void The_physics_log_turned_off_keeps_the_tapes_it_brought()
{
// an ini of before the black box had a key: the tapes came with the physics log
- var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, "physicslog yes\n"));
+ var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, "starter.physicslog.moved yes\nphysicslog yes\n"));
installation.SettingsStore.Load();
installation.SettingsStore.Settings.PhysicsLog = false;
@@ -1385,6 +1385,50 @@ public class SettingsStoreTests
Assert.Equal(recorded, installation.SettingsStore.Settings.BlackBox);
}
+ [Theory]
+ [InlineData("physicslog yes\n", true)]
+ [InlineData("physicslog yes\nblackbox no\n", false)]
+ public void The_physics_log_of_every_vehicle_left_on_is_moved_once_to_the_tapes_of_the_trains(string ini, bool recorded)
+ {
+ var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, ini));
+
+ installation.SettingsStore.Load();
+ var s = installation.SettingsStore.Settings;
+ Assert.False(s.PhysicsLog);
+ Assert.True(s.PhysicsLogTrains);
+ // a black box the ini turned off itself stays off
+ Assert.Equal(recorded, s.BlackBox);
+
+ installation.SettingsStore.Save();
+ Assert.Equal("physicslog no", LineFor(installation, "physicslog"));
+ Assert.Equal("physicslog.trains yes", LineFor(installation, "physicslog.trains"));
+ Assert.Equal("starter.physicslog.moved yes", LineFor(installation, "starter.physicslog.moved"));
+ }
+
+ [Fact]
+ public void The_physics_log_of_every_vehicle_turned_on_again_stays_on()
+ {
+ var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, "physicslog yes\n"));
+ installation.SettingsStore.Load();
+ installation.SettingsStore.Settings.PhysicsLog = true;
+ installation.SettingsStore.Save();
+
+ installation.SettingsStore.Load();
+
+ Assert.True(installation.SettingsStore.Settings.PhysicsLog);
+ Assert.Equal("physicslog yes", LineFor(installation, "physicslog"));
+ }
+
+ [Fact]
+ public void A_new_ini_is_marked_so_the_physics_log_turned_on_later_is_never_moved()
+ {
+ var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, "physicslog no\n"));
+ installation.SettingsStore.Load();
+ installation.SettingsStore.Save();
+
+ Assert.Equal("starter.physicslog.moved yes", LineFor(installation, "starter.physicslog.moved"));
+ }
+
[Fact]
public void The_logs_of_the_trains_are_written_only_once_on_or_where_the_file_has_them()
{
diff --git a/StarterNG/Application/SettingsStore.cs b/StarterNG/Application/SettingsStore.cs
index f538db1..a185609 100644
--- a/StarterNG/Application/SettingsStore.cs
+++ b/StarterNG/Application/SettingsStore.cs
@@ -113,6 +113,8 @@ public sealed class SettingsStore
_serializer.Read(Settings, _config);
_synced = Render(Settings);
+ if (!LoadFailed)
+ SettingsSerializer.MovePhysicsLog(Settings);
TouchConfigAge();
}
diff --git a/StarterNG/Domain/Settings/SimulatorSettings.cs b/StarterNG/Domain/Settings/SimulatorSettings.cs
index b62bf3e..69ca9a1 100644
--- a/StarterNG/Domain/Settings/SimulatorSettings.cs
+++ b/StarterNG/Domain/Settings/SimulatorSettings.cs
@@ -147,6 +147,11 @@ public sealed class SimulatorSettings
public bool PhysicsLogTrains;
/// Whether eu07.ini had a line for the logs of the trains when read: kept, else written only when on.
public bool PhysicsLogTrainsInIni;
+ ///
+ /// Whether the physics log of every vehicle, which a starter before called the speedometer's tapes, was moved once
+ /// to the tapes of the trains and the black box: an ini read with it on and this not yet done is moved so.
+ ///
+ public bool PhysicsLogMoved;
public bool DebugLog = true;
public bool MultipleLogs;
public bool DisplaySimulation = true;
diff --git a/StarterNG/Infrastructure/Settings/SettingsSerializer.cs b/StarterNG/Infrastructure/Settings/SettingsSerializer.cs
index 43198f8..dbce591 100644
--- a/StarterNG/Infrastructure/Settings/SettingsSerializer.cs
+++ b/StarterNG/Infrastructure/Settings/SettingsSerializer.cs
@@ -9,6 +9,25 @@ namespace StarterNG.Infrastructure.Settings;
public sealed class SettingsSerializer
{
+ // the physics log of every vehicle moved once to the tapes of the trains (SimulatorSettings.PhysicsLogMoved)
+ private const string PhysicsLogMovedKey = "starter.physicslog.moved";
+
+ ///
+ /// "physicslog yes", left on from a starter which called it the speedometer's tapes: the log of every vehicle,
+ /// hundreds of files on a big scenery. Moved once to the tapes of the trains, with the black box unless the ini
+ /// turned it off itself; whoever wants the log of every vehicle turns it on again, and it stays so. A change of
+ /// the starter's, after the file is read, so saving writes it.
+ ///
+ public static void MovePhysicsLog(SimulatorSettings s)
+ {
+ if (!s.PhysicsLogMoved && s.PhysicsLog)
+ {
+ s.PhysicsLog = false;
+ s.PhysicsLogTrains = true;
+ }
+ s.PhysicsLogMoved = true;
+ }
+
private readonly bool _dlssPlatform;
/// Whether the simulator can have DLSS here at all (not on macOS).
@@ -162,6 +181,7 @@ public sealed class SettingsSerializer
// the simulator records the black box along with the physics logs when the ini says nothing of it
s.BlackBoxInIni = c.Has("blackbox");
s.BlackBox = s.BlackBoxInIni ? c.GetBool("blackbox", false) : s.PhysicsLog || s.PhysicsLogTrains;
+ s.PhysicsLogMoved = c.GetBool(PhysicsLogMovedKey, false);
int debugLog = c.GetInt("debuglog", 3);
s.DebugLog = (debugLog & 1) != 0;
s.DebugLogVisible = (debugLog & 2) != 0;
@@ -382,6 +402,8 @@ public sealed class SettingsSerializer
// a simulator before it doesn't know the line: an ini without it stays so while it is off
if (s.PhysicsLogTrainsInIni || s.PhysicsLogTrains)
c.SetBool("physicslog.trains", s.PhysicsLogTrains);
+ if (s.PhysicsLogMoved)
+ c.SetBool(PhysicsLogMovedKey, true);
c.SetInt("debuglog",
(s.DebugLog ? 1 : 0) | (s.DebugLogVisible ? 2 : 0) | s.DebugLogExtraBits);
c.SetBool("multiplelogs", s.MultipleLogs);