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: Split off settings.cpp into several separate files #9414

Merged
merged 3 commits into from Jul 6, 2021

Conversation

rubidium42
Copy link
Contributor

Motivation / Problem

Potential workaround for the issue #9386. By splitting the settings table and saveload code off from the main settings file, the settings become more manageable in file size. It also provides a better separation of concerns.

Description

As the motivation already mentioned. Move the table/settings.h include from settings.cpp to a new settings_table.cpp and move the saveload specific code to saveload/settings_sl.cpp.

Review hint: git diff --color-moved as the vast majority is just moving code around. Most work was in reducing the includes though.

Limitations

This won't necessarily work forever with adding settings, though... one could then split of one of the tables into a separate cpp file, or potentially one for each of the tables. In that case settings_table.h does not need to be amended, just settings_table.cpp needs to be split.

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

@rubidium42 rubidium42 changed the title Split off settings.cpp into several separate files Codechange: Split off settings.cpp into several separate files Jul 5, 2021
@glx22
Copy link
Contributor

glx22 commented Jul 6, 2021

Possible fix for VS2017 regression fail (div by 0 in AfterLoad() of intro game) in master...glx22:pr/9414

I think it was working fine before the split because everything was in the same translation unit.

Copy link
Member

@TrueBrain TrueBrain left a comment

Choose a reason for hiding this comment

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

Lets see how long it takes before it comes back ...

@rubidium42 rubidium42 merged commit 7e7a4aa into OpenTTD:master Jul 6, 2021
@rubidium42 rubidium42 deleted the split_off_settings_table branch July 6, 2021 19:32
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

3 participants