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

Codechange: rename SettingGuiFlag to SettingFlag #9332

Merged
merged 1 commit into from Jun 3, 2021

Conversation

TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Jun 3, 2021

Motivation / Problem

@rubidium42 : it happened, it annoyed me enough!!

For the rest: settings have this weird quirk where something is called "guiflags" but is really the flags of the settings. And we have a "flags" which is really the flags of the saveload part. This is so confusing ...

Description

It is a lovely organicly grown enum, where it started off with
GUI-only flags, and after that a few flags got added that can be
considered GUI-only (the GUI disables/enables based on them), to
only have flags added that has nothing to do with the GUI.

So be less confusing, and rename them to what they do.

Additionally, I took this opportunity to rename 0ISDISABLED to
reflect what it really does.

In a follow-up commit I am going to address the flags vs guiflags.

Limitations

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')

SF_NEWGAME_ONLY = 1 << 6, ///< this setting cannot be changed in a game.
SF_SCENEDIT_TOO = 1 << 7, ///< this setting can be changed in the scenario editor (only makes sense when SF_NEWGAME_ONLY is set).
SF_SCENEDIT_ONLY = 1 << 8, ///< this setting can only be changed in the scenario editor.
SF_PER_COMPANY = 1 << 9, ///< this setting can be different for each company (saved in company struct).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is reordering this going to cause any issues?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not as far as I can see and as far as I could test.

Nowhere this value is stored in the savegame. But I would love some extra pairs of eyes on it to validate that claim.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the comments start with a capital?

src/settings_internal.h Outdated Show resolved Hide resolved
src/settings_internal.h Outdated Show resolved Hide resolved
frosch123
frosch123 previously approved these changes Jun 3, 2021
It is a lovely organicly grown enum, where it started off with
GUI-only flags, and after that a few flags got added that can be
considered GUI-only (the GUI disables/enables based on them), to
only have flags added that has nothing to do with the GUI.

So be less confusing, and rename them to what they do.

Additionally, I took this opportunity to rename 0ISDISABLED to
reflect what it really does.
@TrueBrain TrueBrain merged commit feb2ddb into OpenTTD:master Jun 3, 2021
@TrueBrain TrueBrain deleted the rename-setting-flags branch June 3, 2021 19:18
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

4 participants