mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Implement ferry flights for squadron transfers.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1145
This commit is contained in:
@@ -20,7 +20,7 @@ from game.squadrons import Squadron
|
||||
from game.theater import ConflictTheater
|
||||
from gen.flights.flight import Flight
|
||||
from qt_ui.delegates import TwoColumnRowDelegate
|
||||
from qt_ui.models import GameModel, AirWingModel, SquadronModel
|
||||
from qt_ui.models import GameModel, AirWingModel, SquadronModel, AtoModel
|
||||
from qt_ui.windows.SquadronDialog import SquadronDialog
|
||||
|
||||
|
||||
@@ -57,8 +57,14 @@ class SquadronDelegate(TwoColumnRowDelegate):
|
||||
class SquadronList(QListView):
|
||||
"""List view for displaying the air wing's squadrons."""
|
||||
|
||||
def __init__(self, air_wing_model: AirWingModel, theater: ConflictTheater) -> None:
|
||||
def __init__(
|
||||
self,
|
||||
ato_model: AtoModel,
|
||||
air_wing_model: AirWingModel,
|
||||
theater: ConflictTheater,
|
||||
) -> None:
|
||||
super().__init__()
|
||||
self.ato_model = ato_model
|
||||
self.air_wing_model = air_wing_model
|
||||
self.theater = theater
|
||||
self.dialog: Optional[SquadronDialog] = None
|
||||
@@ -78,6 +84,7 @@ class SquadronList(QListView):
|
||||
if not index.isValid():
|
||||
return
|
||||
self.dialog = SquadronDialog(
|
||||
self.ato_model,
|
||||
SquadronModel(self.air_wing_model.squadron_at_index(index)),
|
||||
self.theater,
|
||||
self,
|
||||
@@ -199,7 +206,11 @@ class AirWingTabs(QTabWidget):
|
||||
super().__init__()
|
||||
|
||||
self.addTab(
|
||||
SquadronList(game_model.blue_air_wing_model, game_model.game.theater),
|
||||
SquadronList(
|
||||
game_model.ato_model,
|
||||
game_model.blue_air_wing_model,
|
||||
game_model.game.theater,
|
||||
),
|
||||
"Squadrons",
|
||||
)
|
||||
self.addTab(AirInventoryView(game_model), "Inventory")
|
||||
|
||||
@@ -24,7 +24,7 @@ from game.theater import ControlPoint, ConflictTheater
|
||||
from gen.flights.flight import FlightType
|
||||
from qt_ui.delegates import TwoColumnRowDelegate
|
||||
from qt_ui.errorreporter import report_errors
|
||||
from qt_ui.models import SquadronModel
|
||||
from qt_ui.models import SquadronModel, AtoModel
|
||||
|
||||
|
||||
class PilotDelegate(TwoColumnRowDelegate):
|
||||
@@ -135,10 +135,16 @@ class SquadronDialog(QDialog):
|
||||
"""Dialog window showing a squadron."""
|
||||
|
||||
def __init__(
|
||||
self, squadron_model: SquadronModel, theater: ConflictTheater, parent
|
||||
self,
|
||||
ato_model: AtoModel,
|
||||
squadron_model: SquadronModel,
|
||||
theater: ConflictTheater,
|
||||
parent,
|
||||
) -> None:
|
||||
super().__init__(parent)
|
||||
self.ato_model = ato_model
|
||||
self.squadron_model = squadron_model
|
||||
self.theater = theater
|
||||
|
||||
self.setMinimumSize(1000, 440)
|
||||
self.setWindowTitle(str(squadron_model.squadron))
|
||||
@@ -194,7 +200,8 @@ class SquadronDialog(QDialog):
|
||||
if destination is None:
|
||||
self.squadron.cancel_relocation()
|
||||
else:
|
||||
self.squadron.plan_relocation(destination)
|
||||
self.squadron.plan_relocation(destination, self.theater)
|
||||
self.ato_model.replace_from_game(player=True)
|
||||
|
||||
def check_disabled_button_states(
|
||||
self, button: QPushButton, index: QModelIndex
|
||||
|
||||
Reference in New Issue
Block a user