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 #10395: When loading old saves, don't forcibly bar level crossings #10400

Merged
merged 1 commit into from Jan 23, 2023

Conversation

2TallTyler
Copy link
Member

Motivation / Problem

The savegame conversion in #9931 iterates through all level crossings and updates them, in case the savegame had only one track of a multi-track crossing barred. I erroneously forced every level crossing tile on the map to be barred instead of checking for a closed tile on the same axis. Reported as #10395.

Description

Check the crossing for barred tiles instead of forcing all tiles to be barred.

Closes #10395.

To make review a bit easier, the parameter being changed is force_bar:

/**
 * Update a level crossing to barred or open (crossing may include multiple adjacent tiles).
 * @param tile Tile which causes the update.
 * @param sound Should we play sound?
 * @param force_bar Should we force the crossing to be barred?
 */
void UpdateLevelCrossing(TileIndex tile, bool sound, bool force_bar)

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

@2TallTyler 2TallTyler added backport requested This PR should be backport to current release (RC / stable) size: trivial This Pull Request is trivial labels Jan 22, 2023
@2TallTyler 2TallTyler added this to the 13.0 milestone Jan 22, 2023
@2TallTyler 2TallTyler enabled auto-merge (squash) January 22, 2023 21:52
src/saveload/afterload.cpp Outdated Show resolved Hide resolved
@2TallTyler 2TallTyler merged commit 9c5de7f into OpenTTD:master Jan 23, 2023
@2TallTyler 2TallTyler deleted the level-crossing-afterload branch January 23, 2023 17:09
michicc pushed a commit to michicc/OpenTTD that referenced this pull request Jan 27, 2023
michicc pushed a commit to michicc/OpenTTD that referenced this pull request Jan 28, 2023
@michicc michicc 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 Jan 28, 2023
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) size: trivial This Pull Request is trivial
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Loading a pre-#9931 savegame bars all level crossings, even when no train nearby
3 participants