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 #12301: Update ship current order destination tile when relocating buoys #12303
base: master
Are you sure you want to change the base?
Fix #12301: Update ship current order destination tile when relocating buoys #12303
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
0bf3d92
to
19f7d02
Compare
I would expect something to hook into Might need cached paths to be invalidated too? |
19f7d02
to
0160bff
Compare
0160bff
to
657faf4
Compare
That feels the wrong way around to me. The buoy shouldn't be concerned with whoever is using it as a destination. The ship is heading towards the buoy, so it's the ship's job to find a path to it and keep track of the goal. I find the usage of v->dest_tile a bit strange tbh. Destinations tend to be higher level items such as depots, stations or waypoints. These can then be resolved to a destination tile (or multiple tiles) when a PF call is done. If the position of the destination changes then the next PF run will automatically deal with this. |
src/waypoint_cmd.cpp
Outdated
for (Ship *v : Ship::Iterate()) { | ||
if (v->current_order.IsType(OT_GOTO_WAYPOINT)) { | ||
v->SetDestTile(wp->xy); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please test this PR with ships going to different buoys, and then changing the location of one of the buoys.
As far as I am aware, this is not going to do what you intend it to do in that situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, I see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solved. Also reduced identation while at it.
657faf4
to
4b0050b
Compare
…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.
4b0050b
to
9121ff0
Compare
Motivation / Problem
#12301
Relocating a buoy to another tile isn't updating
v->dest_tile
, sending the wrong tile for the pathfinders.Description
Fix #12301 Update
v->dest_tile
when relocating buoys.Limitations
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.