Changeset - r18285:a4e7d08664db
[Not reviewed]
master
0 1 0
yexo - 13 years ago 2011-11-08 15:00:55
yexo@openttd.org
(svn r23131) -Fix (r16165): AIOrder::IsCurrentOrderPartOfOrderList return false for valid vehicles and crashed for invalid ones
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/ai/api/ai_order.cpp
Show inline comments
 
@@ -125,13 +125,13 @@ static const Order *ResolveOrder(Vehicle
 
	const Order *order = ::ResolveOrder(vehicle_id, order_position);
 
	return order != NULL && order->IsRefit();
 
}
 

	
 
/* static */ bool AIOrder::IsCurrentOrderPartOfOrderList(VehicleID vehicle_id)
 
{
 
	if (AIVehicle::IsValidVehicle(vehicle_id)) return false;
 
	if (!AIVehicle::IsValidVehicle(vehicle_id)) return false;
 
	if (GetOrderCount(vehicle_id) == 0) return false;
 

	
 
	const Order *order = &::Vehicle::Get(vehicle_id)->current_order;
 
	if (order->GetType() != OT_GOTO_DEPOT) return true;
 
	return (order->GetDepotOrderType() & ODTFB_PART_OF_ORDERS) != 0;
 
}
0 comments (0 inline, 0 general)