From cc4237d0762cea396fe56134adf2bc64fa1682c4 Mon Sep 17 00:00:00 2001 From: Raffson Date: Thu, 30 Jun 2022 06:21:18 +0200 Subject: [PATCH] Fix incorrect start types for off-map squadrons. --- qt_ui/windows/mission/flight/QFlightCreator.py | 7 ++++++- qt_ui/windows/mission/flight/settings/QFlightStartType.py | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/qt_ui/windows/mission/flight/QFlightCreator.py b/qt_ui/windows/mission/flight/QFlightCreator.py index 880c28d9..3383e790 100644 --- a/qt_ui/windows/mission/flight/QFlightCreator.py +++ b/qt_ui/windows/mission/flight/QFlightCreator.py @@ -115,6 +115,11 @@ class QFlightCreator(QDialog): tooltip="Selects the start type for this flight.", ) ) + squadron: Squadron = self.squadron_selector.currentData() + home_base: ControlPoint = squadron.location + if isinstance(home_base, OffMapSpawn): + self.start_type.setCurrentText(StartType.IN_FLIGHT.value) + self.start_type.setEnabled(False) layout.addWidget( QLabel( "Any option other than Cold will make this flight " @@ -213,7 +218,7 @@ class QFlightCreator(QDialog): else: self.start_type.setEnabled(True) if self.restore_start_type is not None: - self.start_type.setCurrentText(self.restore_start_type) + self.start_type.setCurrentText(self.restore_start_type.value) self.restore_start_type = None def on_task_changed(self, index: int) -> None: diff --git a/qt_ui/windows/mission/flight/settings/QFlightStartType.py b/qt_ui/windows/mission/flight/settings/QFlightStartType.py index 59e870d2..5b207e34 100644 --- a/qt_ui/windows/mission/flight/settings/QFlightStartType.py +++ b/qt_ui/windows/mission/flight/settings/QFlightStartType.py @@ -8,6 +8,7 @@ from PySide2.QtWidgets import ( from game.ato.flight import Flight from game.ato.starttype import StartType +from game.theater import OffMapSpawn from qt_ui.models import PackageModel @@ -26,6 +27,9 @@ class QFlightStartType(QGroupBox): self.start_type.addItem(start_type.value, start_type) self.start_type.setCurrentText(flight.start_type.value) + if isinstance(self.flight.departure, OffMapSpawn): + self.start_type.setEnabled(False) + self.start_type.currentTextChanged.connect(self._on_start_type_selected) self.main_row.addWidget(self.start_type_label) self.main_row.addWidget(self.start_type)