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: roughly half number of strings for settings #9422

merged 3 commits into from Jul 9, 2021


Copy link

@rubidium42 rubidium42 commented Jul 8, 2021

Motivation / Problem

The SettingDesc structure has two strings for the name. One directly in SettingDesc and one in its contained SaveLoad. For all intents and purposes the string in the SaveLoad is (going to be) the same as the one in the SettingDesc; there is code to copy the name from SettingDesc to SaveLoad when the SettingDesc name is not empty.

So, only when the name of a setting is empty SaveLoad's name is actually used. Setting a name for those few ones with an empty name means we can just write the Setting name in the SaveLoad's name field and stop copying the SettingDesc name to the SaveLoad at a later time.


  • Name the unnamed settings.
  • Create an accessor for the name of a setting.
  • Remove the name field from SettingDesc and save than name in `SaveLoad``.



The name of five settings is changed, including in the compat layer. However, these are only used for old savegames so setting these names has no effect on savegame compatibility.

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 previously approved these changes Jul 9, 2021
@rubidium42 rubidium42 merged commit ede3f79 into OpenTTD:master Jul 9, 2021
15 checks passed
@rubidium42 rubidium42 deleted the fewer_strings branch Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants