mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-15 07:22:21 +01:00
fix(simulation): a test doesn't read the player's own eu07.ini
The simulator reads eu07.ini from %APPDATA%/MaSzyna (~/.config/MaSzyna on Linux) when there is one, in place of the game folder's. A test run then depended on whose machine it ran on. With --test only the game folder's eu07.ini is read, then the files given with -ini. The test mode options are taken from the command line before the settings for that; --test-timeout still wins over test.timeout of any settings file.
This commit is contained in:
@@ -1200,17 +1200,6 @@ int eu07_application::init_settings(int Argc, char *Argv[])
|
||||
{
|
||||
Global.asVersion = VERSION_INFO;
|
||||
|
||||
fs::path iniPath = user_config_path("eu07.ini");
|
||||
|
||||
if (!iniPath.empty() && fs::exists(iniPath))
|
||||
{
|
||||
Global.LoadIniFile(iniPath.string().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.LoadIniFile("eu07.ini");
|
||||
}
|
||||
|
||||
// a test run is known before the rest of the command line is read, so a command line it can't take
|
||||
// ends with the error code of the test, not with 0, which would pass it
|
||||
auto const testcommandline{simulation::parse_test_command_line(std::vector<char const *>(Argv, Argv + Argc))};
|
||||
@@ -1226,6 +1215,19 @@ int eu07_application::init_settings(int Argc, char *Argv[])
|
||||
Global.test.timeout_from_command_line = true;
|
||||
}
|
||||
|
||||
fs::path iniPath = user_config_path("eu07.ini");
|
||||
|
||||
// a test reads the settings of the game folder only (and those given with -ini), not the player's own
|
||||
// (%APPDATA%/MaSzyna, ~/.config/MaSzyna), so it runs the same for whoever runs it
|
||||
if (false == Global.test.enabled && !iniPath.empty() && fs::exists(iniPath))
|
||||
{
|
||||
Global.LoadIniFile(iniPath.string().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.LoadIniFile("eu07.ini");
|
||||
}
|
||||
|
||||
// process command line arguments
|
||||
bool sceneryfromcommandline{false};
|
||||
bool editwithoutscenery{false};
|
||||
|
||||
Reference in New Issue
Block a user