From f89ac52bf3115b1115dccf6236b95baa7e191368 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Thu, 29 Jun 2023 20:24:24 -0700 Subject: [PATCH] Clean up remaining `Flight.from_cp` users. The preferred API for this has been `Flight.departure` for a while. --- game/aircraftparkinglocation.py | 0 game/ato/flight.py | 4 ---- game/ato/flightplans/flightplan.py | 4 ++-- game/missiongenerator/aircraft/flightgroupconfigurator.py | 2 +- game/missiongenerator/aircraft/waypoints/waypointgenerator.py | 2 +- qt_ui/models.py | 2 +- qt_ui/widgets/ato.py | 2 +- qt_ui/windows/mission/QPlannedFlightsView.py | 2 +- .../mission/flight/settings/FlightPlanPropertiesGroup.py | 2 +- 9 files changed, 8 insertions(+), 12 deletions(-) create mode 100644 game/aircraftparkinglocation.py diff --git a/game/aircraftparkinglocation.py b/game/aircraftparkinglocation.py new file mode 100644 index 00000000..e69de29b diff --git a/game/ato/flight.py b/game/ato/flight.py index f06bcc15..123f8cc0 100644 --- a/game/ato/flight.py +++ b/game/ato/flight.py @@ -188,10 +188,6 @@ class Flight(SidcDescribable, RadioFrequencyContainer, TacanContainer): def is_hercules(self) -> bool: return self.unit_type == AircraftType.named("C-130J-30 Super Hercules") - @property - def from_cp(self) -> ControlPoint: - return self.departure - @property def points(self) -> List[FlightWaypoint]: return self.flight_plan.waypoints[1:] diff --git a/game/ato/flightplans/flightplan.py b/game/ato/flightplans/flightplan.py index 7627cd8f..e0419353 100644 --- a/game/ato/flightplans/flightplan.py +++ b/game/ato/flightplans/flightplan.py @@ -291,7 +291,7 @@ class FlightPlan(ABC, Generic[LayoutT]): # This is a workaround to a DCS problem: some AI planes spawn on # the 'sixpack' when start_time is zero and cause a deadlock. # Workaround: force the start_time to 1 second for these planes. - if self.flight.from_cp.is_fleet and start_time.total_seconds() == 0: + if self.flight.departure.is_fleet and start_time.total_seconds() == 0: start_time = timedelta(seconds=1) return start_time @@ -308,7 +308,7 @@ class FlightPlan(ABC, Generic[LayoutT]): def estimate_ground_ops(self) -> timedelta: if self.flight.start_type in {StartType.RUNWAY, StartType.IN_FLIGHT}: return timedelta() - if self.flight.from_cp.is_fleet or self.flight.from_cp.is_fob: + if self.flight.departure.is_fleet or self.flight.departure.is_fob: return timedelta(minutes=2) else: return timedelta(minutes=8) diff --git a/game/missiongenerator/aircraft/flightgroupconfigurator.py b/game/missiongenerator/aircraft/flightgroupconfigurator.py index 04150d7f..10e1cea7 100644 --- a/game/missiongenerator/aircraft/flightgroupconfigurator.py +++ b/game/missiongenerator/aircraft/flightgroupconfigurator.py @@ -125,7 +125,7 @@ class FlightGroupConfigurator: flight_type=self.flight.flight_type, units=self.group.units, size=len(self.group.units), - friendly=self.flight.from_cp.captured, + friendly=self.flight.departure.captured, departure_delay=mission_start_time, departure=self.flight.departure.active_runway( self.game.theater, self.game.conditions, self.dynamic_runways diff --git a/game/missiongenerator/aircraft/waypoints/waypointgenerator.py b/game/missiongenerator/aircraft/waypoints/waypointgenerator.py index 4b052f65..83d54ca1 100644 --- a/game/missiongenerator/aircraft/waypoints/waypointgenerator.py +++ b/game/missiongenerator/aircraft/waypoints/waypointgenerator.py @@ -263,7 +263,7 @@ class WaypointGenerator: # hot aircraft hours before their takeoff time. return True - if self.flight.from_cp.is_fleet: + if self.flight.departure.is_fleet: # Carrier spawns will crowd the carrier deck, especially without # super carrier. # TODO: Is there enough parking on the supercarrier? diff --git a/qt_ui/models.py b/qt_ui/models.py index 86a5d774..3f0dfd07 100644 --- a/qt_ui/models.py +++ b/qt_ui/models.py @@ -145,7 +145,7 @@ class PackageModel(QAbstractListModel): delay = datetime.timedelta( seconds=int(flight.flight_plan.startup_time().total_seconds()) ) - origin = flight.from_cp.name + origin = flight.departure.name return f"{flight} from {origin} in {delay}" @staticmethod diff --git a/qt_ui/widgets/ato.py b/qt_ui/widgets/ato.py index 3b8ff334..f765d591 100644 --- a/qt_ui/widgets/ato.py +++ b/qt_ui/widgets/ato.py @@ -51,7 +51,7 @@ class FlightDelegate(TwoColumnRowDelegate): clients = self.num_clients(index) return f"Player Slots: {clients}" if clients else "" elif (row, column) == (1, 0): - origin = flight.from_cp.name + origin = flight.departure.name if flight.arrival != flight.departure: return f"From {origin} to {flight.arrival.name}" return f"From {origin}" diff --git a/qt_ui/windows/mission/QPlannedFlightsView.py b/qt_ui/windows/mission/QPlannedFlightsView.py index f736a5ed..0ac0af85 100644 --- a/qt_ui/windows/mission/QPlannedFlightsView.py +++ b/qt_ui/windows/mission/QPlannedFlightsView.py @@ -25,7 +25,7 @@ class QPlannedFlightsView(QListView): self.flight_items = [] for package in self.game_model.ato_model.packages: for flight in package.flights: - if flight.from_cp == self.cp: + if flight.departure == self.cp: item = QFlightItem(package.package, flight) self.flight_items.append(item) diff --git a/qt_ui/windows/mission/flight/settings/FlightPlanPropertiesGroup.py b/qt_ui/windows/mission/flight/settings/FlightPlanPropertiesGroup.py index 7401b429..9e1c8b2d 100644 --- a/qt_ui/windows/mission/flight/settings/FlightPlanPropertiesGroup.py +++ b/qt_ui/windows/mission/flight/settings/FlightPlanPropertiesGroup.py @@ -42,7 +42,7 @@ class FlightPlanPropertiesGroup(QGroupBox): self.departure_time = QLabel() layout.addLayout( QLabeledWidget( - f"Departing from {flight.from_cp.name}", self.departure_time + f"Departing from {flight.departure.name}", self.departure_time ) ) self.package_model.tot_changed.connect(self.update_departure_time)