Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: AI/GS settings with the flag SCRIPTCONFIG_RANDOM are re-randomized after loading from a savegame #9540

Open
SamuXarick opened this issue Sep 4, 2021 · 1 comment

Comments

@SamuXarick
Copy link
Contributor

@SamuXarick SamuXarick commented Sep 4, 2021

Version of OpenTTD

12.0-beta2, Windows 10

Expected result

AI/GS settings with the flag SCRIPTCONFIG_RANDOM are unaltered after loading from a savegame.

Actual result

AI/GS settings with the flag SCRIPTCONFIG_RANDOM are re-randomized after loading from a savegame.

Steps to reproduce

  1. Download LuDiAI AfterFix from the online content, as it is one such AI that makes use of SCRIPTCONFIG_RANDOM flag on some of its settings.

  2. Set it up to start.

  3. Start new game and let the AI start.

  4. Take a screenshot of the AI settings window, via AI Debug / Settings
    Unnamed, 1935-01-09

  5. Save game.

  6. Load it back.

  7. Check AI Settings again, compare it to the screenshot, they've been randomized.
    Unnamed, 1935-01-20

Note that only the following settings use SCRIPTCONFIG_RANDOM, combined with SCRIPTCONFIG_INGAME, resulting in the re-randomization of settings after loading from a savegame, and that is not the intended behaviour:
"is_friendly" - flags = CONFIG_BOOLEAN | CONFIG_RANDOM | CONFIG_INGAME
"station_spread" - flags = CONFIG_BOOLEAN | CONFIG_RANDOM | CONFIG_INGAME
"pf_profile" - flags = CONFIG_RANDOM | CONFIG_INGAME
"road_cap_mode" - flags = CONFIG_RANDOM | CONFIG_INGAME
"road_load_mode" - flags = CONFIG_RANDOM | CONFIG_INGAME

The following settings also use SCRIPTCONFIG_RANDOM, but don't get re-randomized, which is the intended behaviour:
"select_town_cargo" - flags = CONFIG_RANDOM
"cities_only" - flags = CONFIG_BOOLEAN | CONFIG_RANDOM
"pick_mode" - flags = CONFIG_RANDOM
"scp_support" - flags = CONFIG_BOOLEAN | CONFIG_RANDOM

@SamuXarick
Copy link
Contributor Author

@SamuXarick SamuXarick commented Sep 4, 2021

This commit is a possible solution (rejected in the past). SamuXarick@d25063a

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant