From b549af9cb7c252de76c20e1d4655dc281c0d091d 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 | 2 +- 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, 7 insertions(+), 11 deletions(-) create mode 100644 game/aircraftparkinglocation.py diff --git a/game/aircraftparkinglocation.py b/game/aircraftparkinglocation.py new file mode 100644 index 000000000..e69de29bb diff --git a/game/ato/flight.py b/game/ato/flight.py index e69d872c7..458b42510 100644 --- a/game/ato/flight.py +++ b/game/ato/flight.py @@ -149,10 +149,6 @@ def unit_type(self) -> AircraftType: def is_helo(self) -> bool: return self.unit_type.dcs_unit_type.helicopter - @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 29b0ee055..5135601ba 100644 --- a/game/ato/flightplans/flightplan.py +++ b/game/ato/flightplans/flightplan.py @@ -283,7 +283,7 @@ def estimate_startup(self) -> timedelta: 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: + if self.flight.departure.is_fleet: return timedelta(minutes=2) else: return timedelta(minutes=8) diff --git a/game/missiongenerator/aircraft/flightgroupconfigurator.py b/game/missiongenerator/aircraft/flightgroupconfigurator.py index 5b579ade3..12913f3f8 100644 --- a/game/missiongenerator/aircraft/flightgroupconfigurator.py +++ b/game/missiongenerator/aircraft/flightgroupconfigurator.py @@ -110,7 +110,7 @@ def configure(self) -> FlightData: 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 259dadf41..85d5ebef1 100644 --- a/game/missiongenerator/aircraft/waypoints/waypointgenerator.py +++ b/game/missiongenerator/aircraft/waypoints/waypointgenerator.py @@ -286,7 +286,7 @@ def should_activate_late(self) -> bool: # 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 707b5e4e6..cc65fc89a 100644 --- a/qt_ui/models.py +++ b/qt_ui/models.py @@ -138,7 +138,7 @@ def data(self, index: QModelIndex, role: int = Qt.DisplayRole) -> Any: @staticmethod def text_for_flight(flight: Flight) -> str: """Returns the text that should be displayed for the flight.""" - origin = flight.from_cp.name + origin = flight.departure.name startup = flight.flight_plan.startup_time() return f"{flight} from {origin} at {startup}" diff --git a/qt_ui/widgets/ato.py b/qt_ui/widgets/ato.py index 36a253df6..0b7b28362 100644 --- a/qt_ui/widgets/ato.py +++ b/qt_ui/widgets/ato.py @@ -46,7 +46,7 @@ def text_for(self, index: QModelIndex, row: int, column: int) -> str: 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 fc7eed78f..2839d14b7 100644 --- a/qt_ui/windows/mission/QPlannedFlightsView.py +++ b/qt_ui/windows/mission/QPlannedFlightsView.py @@ -25,7 +25,7 @@ def setup_content(self): 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 8c05e499b..720d5eda6 100644 --- a/qt_ui/windows/mission/flight/settings/FlightPlanPropertiesGroup.py +++ b/qt_ui/windows/mission/flight/settings/FlightPlanPropertiesGroup.py @@ -32,7 +32,7 @@ def __init__(self, game: Game, package_model: PackageModel, flight: Flight) -> N 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)