| 173 | } |
| 174 | |
| 175 | int PointCollisionData::GetWaterSurfaceHeight() |
| 176 | { |
| 177 | if (_waterSurfaceHeight.has_value()) |
| 178 | return *_waterSurfaceHeight; |
| 179 | |
| 180 | auto* room = &g_Level.Rooms[_roomNumber]; |
| 181 | const auto* sector = Room::GetSector(room, _position.x - room->Position.x, _position.z - room->Position.z); |
| 182 | |
| 183 | // Set water surface height. |
| 184 | bool isBelow = !TestEnvironment(ENV_FLAG_WATER, room); |
| 185 | while (sector->GetNextRoomNumber(_position, isBelow).has_value()) |
| 186 | { |
| 187 | room = &g_Level.Rooms[sector->GetNextRoomNumber(_position, isBelow).value_or(sector->RoomNumber)]; |
| 188 | if (isBelow == TestEnvironment(ENV_FLAG_WATER, room)) |
| 189 | { |
| 190 | _waterSurfaceHeight = sector->GetSurfaceHeight(_position.x, _position.z, isBelow); |
| 191 | return *_waterSurfaceHeight; |
| 192 | } |
| 193 | |
| 194 | sector = Room::GetSector(room, _position.x - room->Position.x, _position.z - room->Position.z); |
| 195 | } |
| 196 | |
| 197 | _waterSurfaceHeight = NO_HEIGHT; |
| 198 | return *_waterSurfaceHeight; |
| 199 | } |
| 200 | |
| 201 | int PointCollisionData::GetWaterBottomHeight() |
| 202 | { |
no test coverage detected