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

Fix #8676: GUI-visible settings may not be part of misc settings. #8678

Merged
merged 2 commits into from Feb 17, 2021

Conversation

michicc
Copy link
Member

@michicc michicc commented Feb 15, 2021

Motivation / Problem

gui.zoom_min and gui.zoom_max need to be early-loaded for GUI auto-zoom to work and were moved to _misc_settings for that. Unfortunately, GUI visible settings may no be there.

Description

This introduces a per-settings flag to decide early-load and moves the two settings back to where they came from.

Limitations

Alternative to #8677.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@glx22
Copy link
Contributor

glx22 commented Feb 15, 2021

Oh the minimal flag could allow no using temp variable for

OpenTTD/src/openttd.cpp

Lines 437 to 440 in db246b8

/* We want the new (correct) NewGRF count to survive the loading. */
uint last_newgrf_count = _settings_client.gui.last_newgrf_count;
LoadFromConfig();
_settings_client.gui.last_newgrf_count = last_newgrf_count;

@frosch123
Copy link
Member

I vote for renaming "minimal" to "bootstrap".

There are two types of settings, where this flag matters:

  • Stuff like "_fullscreen" must be loaded early. The videodriver may fail to switch to fullscreen, and invert the setting. Loading it a second time would make the state inconsistent.
  • Stuff like NewGRF/AI/GS settings must be loaded after the scan.

So, both "minimal" and "only_minimal" are misleading terms:

  • Some settings must be loaded early,
  • some settings must be loaded late, and
  • some settings of the "must load early" may change their value during initialisation and must not be loaded again.

@michicc michicc merged commit 8bd2349 into OpenTTD:master Feb 17, 2021
@michicc michicc deleted the pr/fix_gui_zoom_setting branch February 17, 2021 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants