| 941 | |
| 942 | |
| 943 | bool Game_Map::CanLandAirship(int x, int y) { |
| 944 | if (!Game_Map::IsValid(x, y)) return false; |
| 945 | |
| 946 | const auto* terrain = lcf::ReaderUtil::GetElement(lcf::Data::terrains, GetTerrainTag(x, y)); |
| 947 | if (!terrain) { |
| 948 | Output::Warning("CanLandAirship: Invalid terrain at ({}, {})", x, y); |
| 949 | return false; |
| 950 | } |
| 951 | if (!terrain->airship_land) { |
| 952 | return false; |
| 953 | } |
| 954 | |
| 955 | for (auto& ev: events) { |
| 956 | if (ev.IsInPosition(x, y) |
| 957 | && ev.IsActive() |
| 958 | && ev.GetActivePage() != nullptr) { |
| 959 | return false; |
| 960 | } |
| 961 | } |
| 962 | for (auto vid: { Game_Vehicle::Boat, Game_Vehicle::Ship }) { |
| 963 | auto& vehicle = vehicles[vid - 1]; |
| 964 | if (vehicle.IsInCurrentMap() && vehicle.IsInPosition(x, y)) { |
| 965 | return false; |
| 966 | } |
| 967 | } |
| 968 | |
| 969 | const int bit = Passable::Down | Passable::Right | Passable::Left | Passable::Up; |
| 970 | |
| 971 | int tile_index = x + y * GetTilesX(); |
| 972 | |
| 973 | if (!IsPassableLowerTile(bit, tile_index)) { |
| 974 | return false; |
| 975 | } |
| 976 | |
| 977 | int tile_id = map->upper_layer[tile_index] - BLOCK_F; |
| 978 | tile_id = map_info.upper_tiles[tile_id]; |
| 979 | |
| 980 | return (passages_up[tile_id] & bit) != 0; |
| 981 | } |
| 982 | |
| 983 | bool Game_Map::CanEmbarkShip(Game_Player& player, int x, int y) { |
| 984 | auto bit = GetPassableMask(player.GetX(), player.GetY(), x, y); |
nothing calls this directly
no test coverage detected