mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-27 22:55:16 +01:00
fix: a seed is the whole text and 0 is a seed; Linux honours XDG_CONFIG_HOME and XDG_CACHE_HOME (#469)
* fix(settings): a seed is the whole text as a number, and 0 is a seed seed_of() took the digits in front of a word for the number, so 4242abc was seed 4242, and 12abc and 12xyz were the same seed. Now the whole text has to be the number; anything else is hashed as a word, and a word that starts with digits is said in the log. A seed of 0 also stood for no seed, so -seed 0 and randomseed 0 drew a random one. Whether a seed was given is now kept apart, in random_seed_given, set by -seed, randomseed, the test mode and the server of a network session. random_seed keeps its type. randomseed with nothing after it still gives no seed. Follows up #176. * fix(paths): Linux keeps the settings and the cache where XDG says user_config_path() ignored XDG_CONFIG_HOME, and user_cache_path() took XDG_CACHE_HOME even when it held a relative path. Both now follow the XDG base directory spec: the variable when it is set to an absolute path, else .config or .cache in the home folder. The choice is made by xdg_base_directory(), which takes the values of the variables, so it is tested on every system. Windows and macOS are unchanged. Follows up #29 and #124. * fix(paths): Linux keeps the settings in ~/.config/MaSzyna until XDG_CONFIG_HOME has its own With XDG_CONFIG_HOME set (or under Flatpak), the settings of earlier releases in ~/.config/MaSzyna were silently left behind: the profile eu07.ini, the bindings, the odometers, the editor's settings. The old folder is now used while it exists and $XDG_CONFIG_HOME/MaSzyna doesn't, said once in the log; the one-time move of the orthophoto cache finds the old cache there too. * test: keep the XDG settings test folder out of the shared temp folder
This commit is contained in:
@@ -92,8 +92,10 @@ void apply_test_mode_settings()
|
||||
Global.iMultiplayer = 0;
|
||||
Global.exec_on_exit.clear();
|
||||
// and the same way every time, unless given another seed (-seed, or randomseed in the settings)
|
||||
if (!Global.random_seed)
|
||||
if (false == Global.random_seed_given) {
|
||||
Global.random_seed = seed_of("test");
|
||||
Global.random_seed_given = true;
|
||||
}
|
||||
// the real time limit, which the scenery may set too
|
||||
test().watch_wall_clock(wall_clock_limit(Global.test.wall_timeout, Global.test.timeout));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user