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 #10763, Fix #11168: Display variant groups that consist only of unavailable sub-groups #11342

Merged
merged 1 commit into from Oct 3, 2023

Conversation

merni-ns
Copy link
Contributor

@merni-ns merni-ns commented Sep 30, 2023

Motivation / Problem

Fixes #10763 and fixes #11168.

Essentially, the code added the immediate parent of a variant vehicle to the list, but not higher levels.

Description

Loop through and add all the parents of every variant vehicle up to the top level, so that even when a group consists only of unavailable sub-groups, the top-level group is still displayed when its second-level children are available.

The example provided by @George-VB in #11168 now produces the following list when game is started in 1.1.1970 with default settings.
image

And the example in #10763:
image

Limitations

Not well tested as I cannot write NewGRF nor do I know the actual intended output. Perhaps @George-VB could help with testing.

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

@merni-ns merni-ns force-pushed the fix11168 branch 2 times, most recently from 3d7b1f5 to 8398d2c Compare September 30, 2023 19:46
@merni-ns merni-ns marked this pull request as ready for review October 1, 2023 07:40
@merni-ns merni-ns changed the title Fix #11168: Display variant groups that consist only of unavailable sub-groups Fix #10763, #11168: Display variant groups that consist only of unavailable sub-groups Oct 1, 2023
@merni-ns merni-ns changed the title Fix #10763, #11168: Display variant groups that consist only of unavailable sub-groups Fix #10763, Fix #11168: Display variant groups that consist only of unavailable sub-groups Oct 1, 2023
Copy link
Contributor Author

@merni-ns merni-ns left a comment

Choose a reason for hiding this comment

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

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.

This looks good to me, but needs #11343 to prevent a bad NewGRF creating an infinite loop.

@PeterN PeterN enabled auto-merge (squash) October 3, 2023 12:28
@PeterN PeterN merged commit c794676 into OpenTTD:master Oct 3, 2023
21 checks passed
@merni-ns merni-ns deleted the fix11168 branch October 14, 2023 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants