From d3e1a1df92dfae9ea544c3a7da51d537efb20c7b Mon Sep 17 00:00:00 2001 From: Raffson Date: Sat, 11 May 2024 17:04:43 +0200 Subject: [PATCH] Fix bug w.r.t. OffMapSpawn CPs starting cold --- qt_ui/windows/mission/flight/QFlightCreator.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/qt_ui/windows/mission/flight/QFlightCreator.py b/qt_ui/windows/mission/flight/QFlightCreator.py index 6759f036..91524cb9 100644 --- a/qt_ui/windows/mission/flight/QFlightCreator.py +++ b/qt_ui/windows/mission/flight/QFlightCreator.py @@ -107,7 +107,7 @@ class QFlightCreator(QDialog): self.restore_start_type: Optional[str] = None self.start_type = QComboBox() for start_type in StartType: - self.start_type.addItem(start_type.value, start_type) + self.start_type.addItem(start_type.value, userData=start_type) self.start_type.setCurrentText(self.game.settings.default_start_type.value) layout.addLayout( QLabeledWidget( @@ -116,8 +116,8 @@ class QFlightCreator(QDialog): tooltip="Selects the start type for this flight.", ) ) - if squadron is not None and isinstance(squadron.location, OffMapSpawn): - self.start_type.setCurrentText(StartType.IN_FLIGHT.value) + required_start_type = squadron.location.required_aircraft_start_type + if squadron is not None and required_start_type: self.start_type.setEnabled(False) layout.addWidget( QLabel( @@ -275,8 +275,14 @@ class QFlightCreator(QDialog): # https://github.com/dcs-liberation/dcs_liberation/issues/1567 roster = self.roster_editor.roster + required_start_type = None + squadron = self.squadron_selector.currentData() + if squadron: + required_start_type = squadron.location.required_aircraft_start_type - if roster is not None and roster.player_count > 0: + if required_start_type: + start_type = required_start_type + elif roster is not None and roster.player_count > 0: start_type = self.game.settings.default_start_type_client else: start_type = self.game.settings.default_start_type