/** * Check if a tile is a depot and it is a depot of the given type. */ public static bool IsDepotTypeTile(this TileIndex tile, TransportType type) { switch (type) { default: throw new NotReachedException(); case TransportType.TRANSPORT_RAIL: return(tile.IsRailDepotTile()); case TransportType.TRANSPORT_ROAD: return(tile.IsRoadDepotTile()); case TransportType.TRANSPORT_WATER: return(tile.IsShipDepotTile()); case TransportType.TRANSPORT_AIR: return(tile.IsHangarTile()); } }
/** * Get the index of which depot is attached to the tile. * @param t the tile * @pre IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t) * @return DepotID */ public static DepotID GetDepotIndex(TileIndex t) { /* Hangars don't have a Depot class, thus store no DepotID. */ Debug.Assert(t.IsRailDepotTile() || t.IsRoadDepotTile() || t.IsShipDepotTile()); return(Map._m[t].m2); }
/** * Is the given tile a tile with a depot on it? * @param tile the tile to check * @return true if and only if there is a depot on the tile. */ public static bool IsDepotTile(this TileIndex tile) { return(tile.IsRailDepotTile() || tile.IsRoadDepotTile() || tile.IsShipDepotTile() || tile.IsHangarTile()); }