MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetOrderTypeByTile

Function GetOrderTypeByTile

src/script/api/script_order.cpp:31–50  ·  view source on GitHub ↗

* 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 */

Source from the content-addressed store, hash-verified

29 * @return the order type, or OT_END when there is no order
30 */
31static 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{

Callers 2

AreOrderFlagsValidMethod · 0.85
InsertOrderMethod · 0.85

Calls 9

IsValidTileFunction · 0.85
GetTileTypeFunction · 0.85
IsBuoyFunction · 0.85
IsRailWaypointFunction · 0.85
IsRoadWaypointFunction · 0.85
IsHangarFunction · 0.85
IsShipDepotFunction · 0.85
GetRoadTileTypeFunction · 0.85
IsRailDepotFunction · 0.85

Tested by

no test coverage detected