From ba7b3aa4730221dbae3237c12fe2491e1c720f33 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Sun, 11 Sep 2022 14:45:50 -0700 Subject: [PATCH] Clean up one frontline bounds user. --- game/ato/flightplans/cas.py | 8 ++------ game/missiongenerator/frontlineconflictdescription.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/game/ato/flightplans/cas.py b/game/ato/flightplans/cas.py index 162157c7..b09cec42 100644 --- a/game/ato/flightplans/cas.py +++ b/game/ato/flightplans/cas.py @@ -80,12 +80,8 @@ class Builder(IBuilder[CasFlightPlan, CasLayout]): bounds = FrontLineConflictDescription.frontline_bounds(location, self.theater) ingress = bounds.left_position - center = ingress.point_from_heading( - bounds.heading_from_left_to_right.degrees, bounds.length / 2 - ) - egress = ingress.point_from_heading( - bounds.heading_from_left_to_right.degrees, bounds.length - ) + center = bounds.center + egress = bounds.right_position ingress_distance = ingress.distance_to_point(self.flight.departure.position) egress_distance = egress.distance_to_point(self.flight.departure.position) diff --git a/game/missiongenerator/frontlineconflictdescription.py b/game/missiongenerator/frontlineconflictdescription.py index 9d5a8b0a..ff4a5c3a 100644 --- a/game/missiongenerator/frontlineconflictdescription.py +++ b/game/missiongenerator/frontlineconflictdescription.py @@ -20,6 +20,16 @@ class FrontLineBounds: heading_from_left_to_right: Heading length: int + @property + def center(self) -> Point: + return (self.left_position + self.right_position) / 2 + + @property + def right_position(self) -> Point: + return self.left_position.point_from_heading( + self.heading_from_left_to_right.degrees, self.length + ) + class FrontLineConflictDescription: def __init__(