* Check if the airport would be within the map bounds at the given tile. * @param table Selected layout table. This affects airport rotation, and therefore dimensions. * @param tile Top corner of the airport. * @return true iff the airport would be within the map bounds at the given tile. */
| 98 | * @return true iff the airport would be within the map bounds at the given tile. |
| 99 | */ |
| 100 | bool AirportSpec::IsWithinMapBounds(uint8_t table, TileIndex tile) const |
| 101 | { |
| 102 | if (table >= this->layouts.size()) return false; |
| 103 | |
| 104 | uint8_t w = this->size_x; |
| 105 | uint8_t h = this->size_y; |
| 106 | if (this->layouts[table].rotation == DIR_E || this->layouts[table].rotation == DIR_W) std::swap(w, h); |
| 107 | |
| 108 | return TileX(tile) + w < Map::SizeX() && |
| 109 | TileY(tile) + h < Map::SizeY(); |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * This function initializes the airportspec array. |
no test coverage detected