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

Function IsHangar

src/station_cmd.cpp:97–112  ·  view source on GitHub ↗

* Check whether the given tile is a hangar. * @param t the tile to of whether it is a hangar. * @pre IsTileType(t, MP_STATION) * @return true if and only if the tile is a hangar. */

Source from the content-addressed store, hash-verified

95 * @return true if and only if the tile is a hangar.
96 */
97bool IsHangar(Tile t)
98{
99 assert(IsTileType(t, MP_STATION));
100
101 /* If the tile isn't an airport there's no chance it's a hangar. */
102 if (!IsAirport(t)) return false;
103
104 const Station *st = Station::GetByTile(t);
105 const AirportSpec *as = st->airport.GetSpec();
106
107 for (const auto &depot : as->depots) {
108 if (st->airport.GetRotatedTileFromOffset(depot.ti) == TileIndex(t)) return true;
109 }
110
111 return false;
112}
113
114/**
115 * Look for a station owned by the given company around the given tile area.

Callers 6

IsHangarTileFunction · 0.85
GetTileDesc_StationFunction · 0.85
ClickTile_StationFunction · 0.85
GetOrderTypeByTileFunction · 0.85
GetOrderDestinationMethod · 0.85
IsHangarTileMethod · 0.85

Calls 4

IsTileTypeFunction · 0.85
IsAirportFunction · 0.85
GetSpecMethod · 0.45

Tested by

no test coverage detected