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: wire "load" support into all OMANY and MMANY for settings #11144

Closed
wants to merge 1 commit into from

Conversation

TrueBrain
Copy link
Member

Motivation / Problem

While working on #11143 I had some arguments with the code in respect to load and OMANY.

Description

This PR fixes so that load works for all OMANY (and MMANY). Nobody actually uses it, so you can argue if this PR should be merged, but the current code was silly.

While at it, also reworked the logic slightly, that it first tries to use the lookup, next the conversion, and only after that check if it is a digit. The original code did the digit first, which meant you can't do a lookup starting with a number.

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 touches english.txt or translations? Check the guidelines
  • 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')

Comment on lines +186 to +187
idx = many_cnvt(str);
if (idx != (size_t)-1) return idx;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
idx = many_cnvt(str);
if (idx != (size_t)-1) return idx;
if (many_cnvt != nullptr) {
idx = many_cnvt(str);
if (idx != (size_t)-1) return idx;
}

As far as I can see many_cnvt can be nullptr.

@TrueBrain
Copy link
Member Author

The more I look at this PR, the less I think we should do it. The new stuff isn't used, and one could argue we shouldn't be using this anymore, in favour of renaming settings to remain backwards (and forwards) compatible between versions. So I am going to close this up for now!

@TrueBrain TrueBrain closed this Jul 29, 2023
@TrueBrain TrueBrain deleted the codechange-load branch January 18, 2024 18:46
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