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: Pass by reference to UpdateWidgetSize. #12457

Merged
merged 1 commit into from Apr 9, 2024

Conversation

PeterN
Copy link
Member

@PeterN PeterN commented Apr 8, 2024

Motivation / Problem

Parameters are passed to UpdateWidgetSize() by pointer, but they are not optional and are always present.

Description

Replace pointers with references instead.

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, game_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@LordAro
Copy link
Member

LordAro commented Apr 8, 2024

void function with a "primary" out param? Why not return it? (or even a tuple!)

@PeterN PeterN force-pushed the updatewidgetsize branch 2 times, most recently from cb8da8d to 32b78fb Compare April 8, 2024 19:44
@PeterN
Copy link
Member Author

PeterN commented Apr 8, 2024

As mentioned, it's 3 in,out parameters. I've updated the doxygen to note this.

Copy link
Contributor

@rubidium42 rubidium42 left a comment

Choose a reason for hiding this comment

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

I'm also seeing changes to padding happening in several places, but not everywhere. So what's up with that? Should all the padding stay, or should all the padding go? The two places I put the comments to are definitely not the only places where that happened.

src/company_gui.cpp Outdated Show resolved Hide resolved
src/group_gui.cpp Show resolved Hide resolved
src/news_gui.cpp Outdated Show resolved Hide resolved
src/company_gui.cpp Outdated Show resolved Hide resolved
src/newgrf_gui.cpp Show resolved Hide resolved
These parameters are always provided and not optional.
@PeterN PeterN merged commit de4e00c into OpenTTD:master Apr 9, 2024
15 checks passed
@PeterN PeterN deleted the updatewidgetsize branch April 9, 2024 07:34
ladysadie pushed a commit to ladysadie/OpenTTD_WIP that referenced this pull request Apr 10, 2024
These parameters are always provided and not optional.
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