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: use setting name instead of index for CmdChange(Company)Setting #9306

Merged
merged 1 commit into from
May 29, 2021

Conversation

TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented May 29, 2021

Motivation / Problem

I am working towards splitting up settings.ini into several files. But I find these gems that requires addressing first.

Description

These two especially I wanted to address:

  • There are now constraints on settings.ini you might not expected. For example, conditional settings always have to come last, as otherwise they would influence the index.
  • Adding additional SettingTables to read from would mean several functions need to be aware of this. Now a far few less.

And as bonus:

  • The code becomes a lot simpler because of this.

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

@TrueBrain TrueBrain force-pushed the settings-rework branch 2 times, most recently from b059304 to cd7c0ab Compare May 29, 2021 12:05
src/settings.cpp Show resolved Hide resolved
src/settings.cpp Show resolved Hide resolved
src/settings.cpp Show resolved Hide resolved
@TrueBrain TrueBrain force-pushed the settings-rework branch 2 times, most recently from d03edb8 to 10413a5 Compare May 29, 2021 12:52
@TrueBrain TrueBrain marked this pull request as ready for review May 29, 2021 12:54
@TrueBrain TrueBrain force-pushed the settings-rework branch 5 times, most recently from 1549d36 to 49187b0 Compare May 29, 2021 19:07
@TrueBrain TrueBrain changed the title Codechange: use the setting name instead of index for CmdChange(Company)Setting Codechange: use setting name instead of index for CmdChange(Company)Setting May 29, 2021
…etting

This is mostly done as there are now constraints on settings.ini you might not
expected. For example, conditional settings always have to come last, as otherwise
they would influence the index.
@TrueBrain TrueBrain merged commit d70fb74 into OpenTTD:master May 29, 2021
@TrueBrain TrueBrain deleted the settings-rework branch May 29, 2021 21:27
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

2 participants