Remove unused behavior from frontline positioning.

This commit is contained in:
Dan Albert 2022-09-11 14:53:17 -07:00 committed by Raffson
parent 197b9795f8
commit 459c8d02f9
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

@ -1,6 +1,5 @@
from __future__ import annotations
import logging
from dataclasses import dataclass
from functools import cached_property
from typing import Optional, Tuple
@ -148,12 +147,11 @@ class FrontLineConflictDescription:
max_distance: int,
heading: Heading,
theater: ConflictTheater,
coerce: bool = True,
) -> Optional[Point]:
"""
Finds the nearest valid ground position along a provided heading and it's inverse up to max_distance.
`coerce=True` will return the closest land position to `initial` regardless of heading or distance
`coerce=False` will return None if a point isn't found
"""Finds a valid ground position for the front line center.
Checks for positions along the front line first. If none succeed, the nearest
land position to the initial point is used.
"""
pos = initial
if theater.is_on_land(pos):
@ -165,8 +163,6 @@ class FrontLineConflictDescription:
pos = initial.point_from_heading(heading.opposite.degrees, distance)
if theater.is_on_land(pos):
return pos
if coerce:
pos = theater.nearest_land_pos(initial)
return pos
logging.error("Didn't find ground position ({})!".format(initial))
return None
pos = theater.nearest_land_pos(initial)
return pos