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: store autosave settings under the new names #11143

Merged
merged 3 commits into from Jul 19, 2023

Conversation

TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Jul 17, 2023

Motivation / Problem

While looking for a way to allow aliases for OMANY, I noticed autosave was storing the wrong settings values. And that we have a way to allow aliases.

Description

Instead of storing the old monthly, yearly, etc, store it in minutes.

This keeps the original setting in tact, and renames the new one. This allows switching back between old and new versions without annoying warnings.

Based on comments and feedback, this PR grew a bit bigger to supply a framework for future conversions too. Also makes it a bit more readable :)

Limitations

The GUI doesn't allow for anything between the predefined settings. This means if the user changes the value in the config to something other than 0/10/30/60/120, it will work, till the Game Options are opened again.

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

@PeterN
Copy link
Member

PeterN commented Jul 19, 2023

This will make my 'allow any value' patch a lot simpler 😍

@TrueBrain TrueBrain force-pushed the autosave-setting branch 4 times, most recently from 066a465 to 7467830 Compare July 19, 2023 09:08
…s once

By forcing it only happens once, the first time you upgrade to
a newer client, means you are free to jump between older and newer
versions after that. As they will not resync, the newer setting
can take on any of the (newer) values, without breaking the old
client. And when going to an old client and back, it doesn't
change it back to the converted value anymore.
@TrueBrain TrueBrain merged commit 4f4810d into OpenTTD:master Jul 19, 2023
20 checks passed
@TrueBrain TrueBrain deleted the autosave-setting branch July 19, 2023 11:17
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