* Gets the order type given a tile * @param t the tile to get the order from * @return the order type, or OT_END when there is no order */
| 29 | * @return the order type, or OT_END when there is no order |
| 30 | */ |
| 31 | static OrderType GetOrderTypeByTile(TileIndex t) |
| 32 | { |
| 33 | if (!::IsValidTile(t)) return OT_END; |
| 34 | |
| 35 | switch (::GetTileType(t)) { |
| 36 | default: break; |
| 37 | case MP_STATION: |
| 38 | if (IsBuoy(t) || IsRailWaypoint(t) || IsRoadWaypoint(t)) return OT_GOTO_WAYPOINT; |
| 39 | if (IsHangar(t)) return OT_GOTO_DEPOT; |
| 40 | return OT_GOTO_STATION; |
| 41 | |
| 42 | case MP_WATER: if (::IsShipDepot(t)) return OT_GOTO_DEPOT; break; |
| 43 | case MP_ROAD: if (::GetRoadTileType(t) == RoadTileType::Depot) return OT_GOTO_DEPOT; break; |
| 44 | case MP_RAILWAY: |
| 45 | if (IsRailDepot(t)) return OT_GOTO_DEPOT; |
| 46 | break; |
| 47 | } |
| 48 | |
| 49 | return OT_END; |
| 50 | } |
| 51 | |
| 52 | /* static */ bool ScriptOrder::IsValidVehicleOrder(VehicleID vehicle_id, OrderPosition order_position) |
| 53 | { |
no test coverage detected