mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r14317) -Fix (r13662) [FS#2298]: Order distance processing for conditional orders on ships treated v->orders as an array, and didn't use the correct next order.
This commit is contained in:
parent
54d1b49981
commit
45ce441a55
@ -304,8 +304,10 @@ static uint GetOrderDistance(const Order *prev, const Order *cur, const Vehicle
|
|||||||
if (conditional_depth > v->num_orders) return 0;
|
if (conditional_depth > v->num_orders) return 0;
|
||||||
|
|
||||||
conditional_depth++;
|
conditional_depth++;
|
||||||
return max(GetOrderDistance(prev, &v->orders[cur->GetConditionSkipToOrder()], v, conditional_depth),
|
|
||||||
GetOrderDistance(prev, (prev + 1 == &v->orders[v->num_orders]) ? v->orders : (prev + 1), v, conditional_depth));
|
int dist1 = GetOrderDistance(prev, GetVehicleOrder(v, cur->GetConditionSkipToOrder()), v, conditional_depth);
|
||||||
|
int dist2 = GetOrderDistance(prev, cur->next == NULL ? v->orders : cur->next, v, conditional_depth);
|
||||||
|
return max(dist1, dist2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DistanceManhattan(GetOrderLocation(*prev), GetOrderLocation(*cur));
|
return DistanceManhattan(GetOrderLocation(*prev), GetOrderLocation(*cur));
|
||||||
|
Loading…
Reference in New Issue
Block a user