Skip to content

Commit

Permalink
Fix OpenTTD#12301: Update v->dest_tile when relocating buoys
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
SamuXarick committed Mar 15, 2024
1 parent a7625b8 commit 0160bff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/order_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2197,8 +2197,9 @@ bool ProcessOrders(Vehicle *v)
}

/* If it is unchanged, keep it. */
if (order->Equals(v->current_order) && (v->type == VEH_AIRCRAFT || v->dest_tile != 0) &&
(v->type != VEH_SHIP || !order->IsType(OT_GOTO_STATION) || Station::Get(order->GetDestination())->ship_station.tile != INVALID_TILE)) {
if (order->Equals(v->current_order) && (v->type == VEH_AIRCRAFT || v->dest_tile != 0) && (v->type != VEH_SHIP ||
((!order->IsType(OT_GOTO_STATION) || Station::Get(order->GetDestination())->ship_station.tile != INVALID_TILE) &&
(!order->IsType(OT_GOTO_WAYPOINT) || Waypoint::Get(order->GetDestination())->xy == v->dest_tile)))) {
return false;
}

Expand Down

0 comments on commit 0160bff

Please sign in to comment.