Remove unused behavior from frontline positioning.

This commit is contained in:
Dan Albert 2022-09-11 14:53:17 -07:00
parent 13f0dd8b01
commit c39a094d88

View File

@ -1,6 +1,5 @@
from __future__ import annotations from __future__ import annotations
import logging
from dataclasses import dataclass from dataclasses import dataclass
from functools import cached_property from functools import cached_property
from typing import Optional, Tuple from typing import Optional, Tuple
@ -143,12 +142,11 @@ class FrontLineConflictDescription:
max_distance: int, max_distance: int,
heading: Heading, heading: Heading,
theater: ConflictTheater, theater: ConflictTheater,
coerce: bool = True,
) -> Optional[Point]: ) -> Optional[Point]:
""" """Finds a valid ground position for the front line center.
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 Checks for positions along the front line first. If none succeed, the nearest
`coerce=False` will return None if a point isn't found land position to the initial point is used.
""" """
pos = initial pos = initial
if theater.is_on_land(pos): if theater.is_on_land(pos):
@ -160,8 +158,6 @@ class FrontLineConflictDescription:
pos = initial.point_from_heading(heading.opposite.degrees, distance) pos = initial.point_from_heading(heading.opposite.degrees, distance)
if theater.is_on_land(pos): if theater.is_on_land(pos):
return pos return pos
if coerce:
pos = theater.nearest_land_pos(initial) pos = theater.nearest_land_pos(initial)
return pos return pos
logging.error("Didn't find ground position ({})!".format(initial))
return None