Replace mission planning UI.

Mission planning has been completely redone. Missions are now planned
by right clicking the target area and choosing "New package".

A package can include multiple flights for the same objective. Right
now the automatic flight planner is only fragging single-flight
packages in the same manner that it used to, but that can be improved
now.

The air tasking order (ATO) is now the left bar of the main UI. This
shows every fragged package, and the flights in the selected package.
The info bar that was previously on the left is now a smaller bar at
the bottom of the screen. The old "Mission Planning" button is now
just the "Take Off" button.

The flight plan display no longer shows enemy flight plans. That could
be re-added if needed, probably with a difficulty/cheat option.

Aircraft inventories have been disassociated from the Planner class.
Aircraft inventories are now stored globally in the Game object.

Save games made prior to this update will not be compatible do to the
changes in how aircraft inventories and planned flights are stored.
This commit is contained in:
Dan Albert
2020-09-13 14:32:47 -07:00
parent 0eee5747af
commit ff083942e8
38 changed files with 1807 additions and 695 deletions

View File

@@ -0,0 +1,16 @@
"""Combo box for selecting aircraft types."""
from typing import Iterable
from PySide2.QtWidgets import QComboBox
from dcs.planes import PlaneType
class QAircraftTypeSelector(QComboBox):
"""Combo box for selecting among the given aircraft types."""
def __init__(self, aircraft_types: Iterable[PlaneType]) -> None:
super().__init__()
for aircraft in aircraft_types:
self.addItem(f"{aircraft.id}", userData=aircraft)
self.model().sort(0)

View File

@@ -0,0 +1,22 @@
"""Combo box for selecting a flight's task type."""
from PySide2.QtWidgets import QComboBox
from gen.flights.flight import FlightType
class QFlightTypeComboBox(QComboBox):
"""Combo box for selecting a flight task type."""
def __init__(self) -> None:
super().__init__()
self.addItem("CAP [Combat Air Patrol]", userData=FlightType.CAP)
self.addItem("BARCAP [Barrier Combat Air Patrol]", userData=FlightType.BARCAP)
self.addItem("TARCAP [Target Combat Air Patrol]", userData=FlightType.TARCAP)
self.addItem("INTERCEPT [Interception]", userData=FlightType.INTERCEPTION)
self.addItem("CAS [Close Air Support]", userData=FlightType.CAS)
self.addItem("BAI [Battlefield Interdiction]", userData=FlightType.BAI)
self.addItem("SEAD [Suppression of Enemy Air Defenses]", userData=FlightType.SEAD)
self.addItem("DEAD [Destruction of Enemy Air Defenses]", userData=FlightType.DEAD)
self.addItem("STRIKE [Strike]", userData=FlightType.STRIKE)
self.addItem("ANTISHIP [Antiship Attack]", userData=FlightType.ANTISHIP)
self.model().sort(0)

View File

@@ -0,0 +1,41 @@
"""Combo box for selecting a departure airfield."""
from typing import Iterable
from PySide2.QtWidgets import QComboBox
from dcs.planes import PlaneType
from game.inventory import GlobalAircraftInventory
from theater.controlpoint import ControlPoint
class QOriginAirfieldSelector(QComboBox):
"""A combo box for selecting a flight's departure airfield.
The combo box will automatically be populated with all departure airfields
that have unassigned inventory of the given aircraft type.
"""
def __init__(self, global_inventory: GlobalAircraftInventory,
origins: Iterable[ControlPoint],
aircraft: PlaneType) -> None:
super().__init__()
self.global_inventory = global_inventory
self.origins = list(origins)
self.aircraft = aircraft
self.rebuild_selector()
def change_aircraft(self, aircraft: PlaneType) -> None:
if self.aircraft == aircraft:
return
self.aircraft = aircraft
self.rebuild_selector()
def rebuild_selector(self) -> None:
self.clear()
for origin in self.origins:
inventory = self.global_inventory.for_control_point(origin)
available = inventory.available(self.aircraft)
if available:
self.addItem(f"{origin.name} ({available} available)", origin)
self.model().sort(0)
self.update()