mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Display a "No aircraft available" message.
If in the create flight dialog, there are no suitable aircraft for a task, or no aircraft left at all, a suitable message is now shown that prevents the user from creating a flight. Also adds in a quick "remember what plane the user had selected last" feature.
This commit is contained in:
parent
c40ad75fa2
commit
1e1cebc3fc
@ -23,6 +23,7 @@ class QAircraftTypeSelector(QComboBox):
|
||||
self.updateItems(mission_type, aircraft_types)
|
||||
|
||||
def updateItems(self, mission_type: str, aircraft_types):
|
||||
current_aircraft = self.currentData()
|
||||
self.clear()
|
||||
for aircraft in aircraft_types:
|
||||
if mission_type in [FlightType.BARCAP, FlightType.ESCORT, FlightType.INTERCEPTION, FlightType.SWEEP, FlightType.TARCAP]:
|
||||
@ -42,4 +43,9 @@ class QAircraftTypeSelector(QComboBox):
|
||||
self.addItem(f"{db.unit_pretty_name(self.country, aircraft)}", userData=aircraft)
|
||||
elif mission_type in [FlightType.OCA_RUNWAY]:
|
||||
if aircraft in gen.flights.ai_flight_planner_db.RUNWAY_ATTACK_CAPABLE:
|
||||
self.addItem(f"{db.unit_pretty_name(self.country, aircraft)}", userData=aircraft)
|
||||
self.addItem(f"{db.unit_pretty_name(self.country, aircraft)}", userData=aircraft)
|
||||
current_aircraft_index = self.findData(current_aircraft)
|
||||
if current_aircraft_index != -1:
|
||||
self.setCurrentIndex(current_aircraft_index)
|
||||
if self.count() == 0:
|
||||
self.addItem("No capable aircraft available", userData=None)
|
||||
@ -117,6 +117,8 @@ class QFlightCreator(QDialog):
|
||||
arrival: ControlPoint = self.arrival.currentData()
|
||||
divert: ControlPoint = self.divert.currentData()
|
||||
size: int = self.flight_size_spinner.value()
|
||||
if aircraft == None:
|
||||
return "You must select an aircraft type."
|
||||
if not origin.captured:
|
||||
return f"{origin.name} is not owned by your coalition."
|
||||
if arrival is not None and not arrival.captured:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user