summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-07-10 18:30:02 +0000
committerrubidium <rubidium@openttd.org>2009-07-10 18:30:02 +0000
commit3b8d0621a2621531e9be38cf3247e015558f1971 (patch)
treefc75fa25c77168ae6d138cadd380b5d8802c800a /src/ai
parentc654dedb28b9f3f15eda261545daa333534a7177 (diff)
downloadopenttd-3b8d0621a2621531e9be38cf3247e015558f1971.tar.xz
(svn r16785) -Codechange: make ships going to buoys use OT_GOTO_WAYPOINT too
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/api/ai_order.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ai/api/ai_order.cpp b/src/ai/api/ai_order.cpp
index 1378b9ea9..7cd791562 100644
--- a/src/ai/api/ai_order.cpp
+++ b/src/ai/api/ai_order.cpp
@@ -26,6 +26,7 @@ static OrderType GetOrderTypeByTile(TileIndex t)
default: break;
case MP_STATION:
if (IsHangar(t)) return OT_GOTO_DEPOT;
+ if (IsBuoy(t)) return OT_GOTO_WAYPOINT;
return OT_GOTO_STATION;
break;
case MP_WATER: if (::IsShipDepot(t)) return OT_GOTO_DEPOT; break;
@@ -201,7 +202,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
}
return INVALID_TILE;
}
- case OT_GOTO_WAYPOINT: return ::Waypoint::Get(order->GetDestination())->xy;
+ case OT_GOTO_WAYPOINT: return v->type == VEH_TRAIN ? ::Waypoint::Get(order->GetDestination())->xy : ::Station::Get(order->GetDestination())->xy;
default: return INVALID_TILE;
}
}
@@ -358,7 +359,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
break;
case OT_GOTO_WAYPOINT:
- order.MakeGoToWaypoint(::GetWaypointIndex(destination));
+ order.MakeGoToWaypoint(::Vehicle::Get(vehicle_id)->type == VEH_TRAIN ? ::GetWaypointIndex(destination) : ::GetStationIndex(destination));
break;
default: