diff --git a/qt_ui/widgets/QTopPanel.py b/qt_ui/widgets/QTopPanel.py index 6c3a473b..e425c476 100644 --- a/qt_ui/widgets/QTopPanel.py +++ b/qt_ui/widgets/QTopPanel.py @@ -244,11 +244,44 @@ class QTopPanel(QFrame): return True return False + def check_no_missing_pilots(self) -> bool: + missing_pilots = [] + for package in self.game.blue_ato.packages: + for flight in package.flights: + if flight.missing_pilots > 0: + missing_pilots.append((package, flight)) + + if not missing_pilots: + return False + + formatted = "
".join( + [f"{p.primary_task} {p.target}: {f}" for p, f in missing_pilots] + ) + mbox = QMessageBox( + QMessageBox.Critical, + "Flights are missing pilots", + ( + "The following flights are missing one or more pilots:
" + "
" + f"{formatted}
" + "
" + "You must either assign pilots to those flights or cancel those " + "missions." + ), + parent=self, + ) + mbox.setEscapeButton(mbox.addButton(QMessageBox.Close)) + mbox.exec_() + return True + def launch_mission(self): """Finishes planning and waits for mission completion.""" if not self.ato_has_clients() and not self.confirm_no_client_launch(): return + if self.check_no_missing_pilots(): + return + negative_starts = self.negative_start_packages() if negative_starts: if not self.confirm_negative_start_time(negative_starts):