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 #11442: "default" colour in group colour window is not updated when changing master colour #11614

Merged
merged 1 commit into from
Dec 22, 2023

Conversation

Darragh-Hazell
Copy link
Contributor

Motivation / Problem

As described in issue #11442. When setting the default company livery colour, previously created groups that use the default company livery will still display the default colour as being the one automatically set at the start of the game.

This is purely an interface issue which can prove distracting and/or confusing to the user due to the visible inconsistency it creates.

Description

Under company_gui.cpp the DrawWidget method of SelectCompanyLiveryWIndow is responsible for rendering the default colour square preview in the groups window.

The company default livery can be conditionally passed, to draw_livery, instead of the group livery. This is done with a constant boolean, livery_set, from HasBit on the group’s livery.in_use 0 bit. livery_set is also passed to the def parameter.

Furthermore, both branches of the if else statement of DrawWidget use the company constant, it was moved to be before the if statement so that both conditionals had it within their scope.

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

…ated when changing master colour

Updated SelectCompanyLiveryWindow.DrawWidget method to check if a group's livery.in_use 0 bit is set, rendering the company's default colour if it has not been.
Copy link
Member

@PeterN PeterN left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@glx22 glx22 merged commit acfe367 into OpenTTD:master Dec 22, 2023
20 checks passed
@Darragh-Hazell Darragh-Hazell deleted the fix-11442 branch December 22, 2023 23:05
PeterN added a commit to PeterN/OpenTTD that referenced this pull request Dec 27, 2023
OpenTTD#11614 attempted to address this but did not handle 2CC properly, and changes to the default livery were not handled.
PeterN added a commit to PeterN/OpenTTD that referenced this pull request Dec 27, 2023
OpenTTD#11614 attempted to address this but did not handle 2CC properly, and changes to the default livery were not handled.
PeterN added a commit that referenced this pull request Dec 28, 2023
#11614 attempted to address this but did not handle 2CC properly, and changes to the default livery were not handled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview This PR is receiving preview builds
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants