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: Iterate over all stacked vehicle sprites when evaluating random triggers. #9195

Closed
wants to merge 1 commit into from

Conversation

PeterN
Copy link
Member

@PeterN PeterN commented May 5, 2021

Motivation / Problem

RandomAction2s for any sub-sprite within a stacked vehicle sprite result are not evaluated during a trigger.

Description

This PR changes this so that all sub-sprite chains are evaluated. Waiting trigger states are combined after every call is completed.

Limitations

  • This is currently untested (not even with regular non-stacked sprites)
  • It may incur a performance penalty. Also untested...

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

@PeterN
Copy link
Member Author

PeterN commented May 5, 2021

It may be better to not support this and require authors to duplicate their randomaction2s in the "main" chain (or an explicit CB1 test), which was the solution for a similar issue with station triggers.

@frosch123
Copy link
Member

Sprite stacks is not the only case where RandomAction2 are not rerandomised:

I don't think the implicit "RA2 are randomised in the sprite chain" works particular well. It has too many exceptions.
I think we should rather explicitly document a "rerandomisation callback", which has to contain RA2 for all bits, that shall be rerandomised.

@PeterN PeterN closed this May 5, 2021
@PeterN PeterN deleted the triggers-image-stack branch May 5, 2021 18:05
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

2 participants