Fix #9521: Don't load at just removed docks that were part of a multi-dock station #9524
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation / Problem
Fixes #9521
Given the scenario with a station with 2 (or more) docks (with 2 docking tiles), if the ship is loading/unloading at one of the docks, and that dock is demolished, the ship still continues to load/unload, because the station facility
FACIL_DOCK
still exists.It should instead, make the ship go to the other dock of that same station.
Description
Problem is solved by also checking if the docking tile where the ship is positioned at is still valid and belong to the station entity.
Savegame:
multidock 2.zip
In this savegame, ship 1 and ship 3 are unloading at Würzbrücken Docks which consist of 2 docks with 2 docking tiles.
Würzbrucken Valley is another dock that shares the same docking tile as that where ship 3 is located.
Tests:
1 - Removing Würzbrücken Valley dock should not affect ship 3 unloading at the other dock.
2 - Removing one of the Würzbrücken Docks should make the ship that it's at the respective docking tile to leave station and head to the other dock nearby that still belongs to the same station.
Limitations
tile3
is a docking tile and is retrieved in that manner. Maybe there is a better way to retrieve which tiles are the docking tiles.Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.