diff options
author | rubidium <rubidium@openttd.org> | 2009-07-22 08:59:57 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-07-22 08:59:57 +0000 |
commit | 68ead6b84f56ad3c93d05ad3e09b7fbb8173cf26 (patch) | |
tree | ee33bd19b96a138530a84e86e7ffd60c0700f9d9 /src/ai/api/ai_order.cpp | |
parent | 2646a99d29535a44c5998f080131cbca2e85bdcf (diff) | |
download | openttd-68ead6b84f56ad3c93d05ad3e09b7fbb8173cf26.tar.xz |
(svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
-Change: make (rail) waypoints sub classes of 'base stations', make buoys waypoints and unify code between them where possible.
Diffstat (limited to 'src/ai/api/ai_order.cpp')
-rw-r--r-- | src/ai/api/ai_order.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/ai/api/ai_order.cpp b/src/ai/api/ai_order.cpp index 7cd791562..5069bcb5e 100644 --- a/src/ai/api/ai_order.cpp +++ b/src/ai/api/ai_order.cpp @@ -25,18 +25,14 @@ static OrderType GetOrderTypeByTile(TileIndex t) switch (::GetTileType(t)) { default: break; case MP_STATION: + if (IsBuoy(t) || IsRailWaypoint(t)) return OT_GOTO_WAYPOINT; 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; case MP_ROAD: if (::GetRoadTileType(t) == ROAD_TILE_DEPOT) return OT_GOTO_DEPOT; break; case MP_RAILWAY: - switch (::GetRailTileType(t)) { - case RAIL_TILE_DEPOT: return OT_GOTO_DEPOT; - case RAIL_TILE_WAYPOINT: return OT_GOTO_WAYPOINT; - default: break; - } + if (IsRailDepot(t)) return OT_GOTO_DEPOT; break; } @@ -359,7 +355,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or break; case OT_GOTO_WAYPOINT: - order.MakeGoToWaypoint(::Vehicle::Get(vehicle_id)->type == VEH_TRAIN ? ::GetWaypointIndex(destination) : ::GetStationIndex(destination)); + order.MakeGoToWaypoint(::GetStationIndex(destination)); break; default: |