From c2eb2430265affb56222f0b7c3ff2d6ecf148d7a Mon Sep 17 00:00:00 2001 From: walterroach <37820425+walterroach@users.noreply.github.com> Date: Sun, 22 Nov 2020 17:32:05 -0600 Subject: [PATCH] Fix bug #400 arg position --- gen/conflictgen.py | 10 ++++++++++ gen/flights/flightplan.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gen/conflictgen.py b/gen/conflictgen.py index 136a0dff..1a204d9d 100644 --- a/gen/conflictgen.py +++ b/gen/conflictgen.py @@ -116,6 +116,16 @@ class Conflict: position = frontline.position return position, _opposite_heading(attack_heading) + @classmethod + def flight_frontline_vector(cls, from_cp: ControlPoint, to_cp: ControlPoint, theater: ConflictTheater) -> Tuple[Point, int, int]: + """Returns the frontline vector without regard for exclusion zones, used in CAS flight plan""" + frontline = cls.frontline_position(from_cp, to_cp, theater) + center_position, heading = frontline + left_position = center_position.point_from_heading(_heading_sum(heading, -90), int(FRONTLINE_LENGTH/2)) + right_position = center_position.point_from_heading(_heading_sum(heading, 90), int(FRONTLINE_LENGTH/2)) + + return left_position, _heading_sum(heading, 90), int(right_position.distance_to_point(left_position)) + @classmethod def frontline_vector(cls, from_cp: ControlPoint, to_cp: ControlPoint, theater: ConflictTheater) -> Tuple[Point, int, int]: diff --git a/gen/flights/flightplan.py b/gen/flights/flightplan.py index d8758e32..6ad8cec9 100644 --- a/gen/flights/flightplan.py +++ b/gen/flights/flightplan.py @@ -998,7 +998,7 @@ class FlightPlanBuilder: if not isinstance(location, FrontLine): raise InvalidObjectiveLocation(flight.flight_type, location) - ingress, heading, distance = Conflict.frontline_vector( + ingress, heading, distance = Conflict.flight_frontline_vector( location.control_points[0], location.control_points[1], self.game.theater )