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

[Bug]: Ship becomes lost after moving buoy #12301

Open
SamuXarick opened this issue Mar 15, 2024 · 1 comment · May be fixed by #12303
Open

[Bug]: Ship becomes lost after moving buoy #12301

SamuXarick opened this issue Mar 15, 2024 · 1 comment · May be fixed by #12303
Labels
component: pathfinder This issue is related to Pathfinder

Comments

@SamuXarick
Copy link
Contributor

SamuXarick commented Mar 15, 2024

Version of OpenTTD

Openttd 20240315-master-ga7625b8ae0

Expected result

Either v->dest_tile is updated upon relocation, or some other more elaborate method needs to be used to reflect the actual location of the buoy.

Actual result

This bug is deeper and has nothing to do with the pathfinder. It's about buoy location. The buoy is removed and moved to another tile, this doesn't update the v->dest_tile of vehicles.
What happened:
The previous location of the buoy was valid, but then demolished, and rebuilt to a near location, reusing the same WaypointID value, but with a different location. The old place was then raised terrain and became waterless.
The pathfinder is given the old location, and the high lvl pathfinder finds a patch with no water, hence the label 0.
Low level pathfinder doesn't even get the chance, it fails right away in high level pathfinder with a size of 0
would probably be given the same erroneous location, since it's also m_destTile = v->dest_tile;

Steps to reproduce

  1. Build a buoy.
  2. Build a ship.
  3. Add order to go to buoy.
  4. Start ship.
  5. Demolish buoy.
  6. Rebuild buoy near the old location, reusing the same WaypointID.
  7. Raise terrain on the old location so that it becomes waterless.

Ship is lost!

ship 2 is lost because buoy was relocated.zip

@LordAro
Copy link
Member

LordAro commented Mar 15, 2024

Just a note on the issue reporting - issues should describe the problem as it appears to the user, rather than where you think the issue is in the code. To do otherwise risks making a solution to the wrong problem, or finding a solution to a non-existent problem

It's perfectly fine for the extended description to describe what you think, but the bug report itself must be about the problem, not the solution.

(unless an issue is entirely "this code needs cleanup/refactoring/whatever", of course)

@SamuXarick SamuXarick changed the title [Bug]: Relocated buoys don't update v->dest_tile [Bug]: Ship becomes lost after moving buoy Mar 15, 2024
SamuXarick added a commit to SamuXarick/OpenTTD that referenced this issue Mar 15, 2024
Moving buoys caused current_order to be detected as unchanged, making pathfinders to compute a path to an outdated v->dest_tile.

Properly update v->dest_tile before reaching pathfinders.
SamuXarick added a commit to SamuXarick/OpenTTD that referenced this issue Mar 15, 2024
Moving buoys caused current_order to be detected as unchanged, making pathfinders to compute a path to an outdated v->dest_tile.

Properly update v->dest_tile before reaching pathfinders.
SamuXarick added a commit to SamuXarick/OpenTTD that referenced this issue Mar 15, 2024
…locating buoys

Moving buoys caused current_order to be detected as unchanged, making pathfinders to compute a path to an outdated v->dest_tile.

Properly update v->dest_tile before reaching pathfinders.

ok
SamuXarick added a commit to SamuXarick/OpenTTD that referenced this issue Mar 17, 2024
…locating buoys

Moving buoys caused current_order to be detected as unchanged, making pathfinders to compute a path to an outdated v->dest_tile.

Properly update v->dest_tile before reaching pathfinders.
SamuXarick added a commit to SamuXarick/OpenTTD that referenced this issue Mar 17, 2024
…locating buoys

Moving buoys caused current_order to be detected as unchanged, making pathfinders to compute a path to an outdated v->dest_tile.

Properly update v->dest_tile before reaching pathfinders.
@2TallTyler 2TallTyler added the component: pathfinder This issue is related to Pathfinder label Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pathfinder This issue is related to Pathfinder
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants