Changeset - r28407:4cf3e4aeb553
[Not reviewed]
master
0 1 0
SamuXarick - 4 months ago 2024-01-05 21:23:01
43006711+SamuXarick@users.noreply.github.com
Fix #10511: Delay 'go to nearest depot' orders (#11548)

Delay the nearest depot order search for a day if the vehicle can't find its destination, which happens when it has already attempted to do so and failed to find a valid destination.
1 file changed with 4 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/order_cmd.cpp
Show inline comments
 
@@ -1961,6 +1961,10 @@ bool UpdateOrderDest(Vehicle *v, const O
 
			}
 

	
 
			if (v->current_order.GetDepotActionType() & ODATFB_NEAREST_DEPOT) {
 
				/* If the vehicle can't find its destination, delay its next search.
 
				 * In case many vehicles are in this state, use the vehicle index to spread out pathfinder calls. */
 
				if (v->dest_tile == 0 && TimerGameCalendar::date_fract != (v->index % Ticks::DAY_TICKS)) break;
 

	
 
				/* We need to search for the nearest depot (hangar). */
 
				ClosestDepot closestDepot = v->FindClosestDepot();
 

	
0 comments (0 inline, 0 general)