(svn r18667) -Fix [FS#3454]: [NoAI] crash when trying to get the order destination of a 'nearest depot' order

This commit is contained in:
rubidium 2009-12-30 18:07:28 +00:00
parent 4801b17837
commit e6dbe673f0

View File

@ -175,6 +175,9 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
switch (order->GetType()) {
case OT_GOTO_DEPOT: {
/* We don't know where the nearest depot is... (yet) */
if (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) return INVALID_TILE;
if (v->type != VEH_AIRCRAFT) return ::Depot::Get(order->GetDestination())->xy;
/* Aircraft's hangars are referenced by StationID, not DepotID */
const Station *st = ::Station::Get(order->GetDestination());