mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Clean up flight plan code.
Split the oversized file into one per plan type. This also moves the layout responsibility out of the oversized FlightPlanBuilder and into each flight plan type file.
This commit is contained in:
@@ -16,7 +16,8 @@ from PySide2.QtWidgets import (
|
||||
)
|
||||
|
||||
from game.ato.flight import Flight
|
||||
from game.ato.flightplan import FlightPlanBuilder, PlanningError
|
||||
from game.ato.flightplans.flightplanbuilder import FlightPlanBuilder
|
||||
from game.ato.flightplans.planningerror import PlanningError
|
||||
from game.ato.package import Package
|
||||
from game.game import Game
|
||||
from game.server import EventStream
|
||||
|
||||
@@ -4,7 +4,8 @@ from PySide2.QtWidgets import QGroupBox, QLabel, QMessageBox, QVBoxLayout
|
||||
|
||||
from game import Game
|
||||
from game.ato.flight import Flight
|
||||
from game.ato.flightplan import FlightPlanBuilder, PlanningError
|
||||
from game.ato.flightplans.flightplanbuilder import FlightPlanBuilder
|
||||
from game.ato.flightplans.planningerror import PlanningError
|
||||
from game.ato.traveltime import TotEstimator
|
||||
from qt_ui.models import PackageModel
|
||||
from qt_ui.widgets.QLabeledWidget import QLabeledWidget
|
||||
|
||||
@@ -12,17 +12,15 @@ from PySide2.QtWidgets import (
|
||||
)
|
||||
|
||||
from game import Game
|
||||
from game.ato.package import Package
|
||||
from game.ato.flight import Flight
|
||||
from game.ato.flightplans.custom import CustomFlightPlan
|
||||
from game.ato.flightplans.flightplanbuilder import FlightPlanBuilder
|
||||
from game.ato.flightplans.formationattack import FormationAttackFlightPlan
|
||||
from game.ato.flightplans.planningerror import PlanningError
|
||||
from game.ato.flighttype import FlightType
|
||||
from game.ato.flightwaypoint import FlightWaypoint
|
||||
from game.ato.flight import Flight
|
||||
from game.ato.flightplan import (
|
||||
CustomFlightPlan,
|
||||
FlightPlanBuilder,
|
||||
PlanningError,
|
||||
StrikeFlightPlan,
|
||||
)
|
||||
from game.ato.loadouts import Loadout
|
||||
from game.ato.package import Package
|
||||
from qt_ui.windows.mission.flight.waypoints.QFlightWaypointList import (
|
||||
QFlightWaypointList,
|
||||
)
|
||||
@@ -107,7 +105,7 @@ class QFlightWaypointTab(QFrame):
|
||||
# Need to degrade to a custom flight plan and remove the waypoint.
|
||||
# If the waypoint is a target waypoint and is not the last target
|
||||
# waypoint, we don't need to degrade.
|
||||
if isinstance(self.flight.flight_plan, StrikeFlightPlan):
|
||||
if isinstance(self.flight.flight_plan, FormationAttackFlightPlan):
|
||||
is_target = waypoint in self.flight.flight_plan.targets
|
||||
if is_target and len(self.flight.flight_plan.targets) > 1:
|
||||
self.flight.flight_plan.targets.remove(waypoint)
|
||||
@@ -144,9 +142,8 @@ class QFlightWaypointTab(QFrame):
|
||||
def degrade_to_custom_flight_plan(self) -> None:
|
||||
if not isinstance(self.flight.flight_plan, CustomFlightPlan):
|
||||
self.flight.flight_plan = CustomFlightPlan(
|
||||
package=self.flight.package,
|
||||
flight=self.flight,
|
||||
custom_waypoints=self.flight.flight_plan.waypoints,
|
||||
waypoints=self.flight.flight_plan.waypoints,
|
||||
)
|
||||
|
||||
def confirm_recreate(self, task: FlightType) -> None:
|
||||
|
||||
Reference in New Issue
Block a user