Improve AGL to AMSL transition for naval waypoints

Some maps have inaccurate bounds for sea-zones, thus waypoints that end up being too close to the shore may keep using AGL which could still lead to trouble. Adding a condition to check whether a point is "not on land" will likely fix this issue for maps that have gaps between sea-zones and inclusion-zones around the shoreline...
This commit is contained in:
Raffson 2024-11-09 14:49:38 +01:00
parent b5225f03a1
commit 84c4b992e0
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
2 changed files with 10 additions and 7 deletions

View File

@ -85,9 +85,11 @@ class PydcsWaypointBuilder:
return waypoint
def switch_to_baro_if_in_sea(self, waypoint: MovingPoint) -> None:
if (
waypoint.alt_type == "RADIO"
and self.flight.coalition.game.theater.is_in_sea(waypoint.position)
if waypoint.alt_type == "RADIO" and (
self.flight.coalition.game.theater.is_in_sea(waypoint.position)
or not self.flight.coalition.game.theater.is_on_land(
waypoint.position, ignore_exclusion=True
)
):
waypoint.alt_type = "BARO"

View File

@ -75,7 +75,7 @@ class ConflictTheater:
return False
def is_on_land(self, point: Point) -> bool:
def is_on_land(self, point: Point, ignore_exclusion: bool = False) -> bool:
if not self.landmap:
return True
@ -86,9 +86,10 @@ class ConflictTheater:
if not is_point_included:
return False
for exclusion_zone in self.landmap.exclusion_zones.geoms:
if poly_contains(point.x, point.y, exclusion_zone):
return False
if not ignore_exclusion:
for exclusion_zone in self.landmap.exclusion_zones.geoms:
if poly_contains(point.x, point.y, exclusion_zone):
return False
return True