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: Don't show train waiting for unbunching as waiting for free path #12515

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

2TallTyler
Copy link
Member

Motivation / Problem

When multiple trains waiting to unbunch all try to leave at once, but are blocked because the PBS block leaving the depot is occupied, they call MarkTrainAsStuck(v); to set their status bar to Waiting for free path.

When a train successfully leaves, it assigns the next departure time to the others, which go back to waiting for unbunching.

In the status bar GUI, this status is checked before the unbunching status is checked, so that a train waiting for unbunching is incorrectly marked as awaiting a free path. This is confusing to the player, who sees nothing blocking its path.

Description

Alter the order that the string is chosen, so that a train waiting for unbunching is indicated accordingly in its status bar, regardless of if it has the stuck flag.

To test this:

  1. Load this savegame: MarkedStuck.zip
  2. Open windows for Trains 1-4 and see that they are all trying to leave but are blocked by Train 5.
  3. Start Train 5. One of the waiting trains will leave and assign the others a future departure time.
  4. In 14.0, these other trains will still show Waiting for free path but are actually unbunching. In this PR, the statusbar will go back to Waiting to unbunch.

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

@2TallTyler 2TallTyler added the backport requested This PR should be backport to current release (RC / stable) label Apr 17, 2024
@2TallTyler 2TallTyler merged commit a02da54 into OpenTTD:master Apr 17, 2024
15 checks passed
@2TallTyler 2TallTyler deleted the unbunch-marked-stuck branch April 17, 2024 19:04
@glx22 glx22 added backported This PR is backported to a current release (RC / stable) and removed backport requested This PR should be backport to current release (RC / stable) labels Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported This PR is backported to a current release (RC / stable)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants