mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Add warnings for invalid fast-forward settings.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2739.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import textwrap
|
||||
from datetime import datetime
|
||||
from typing import List, Optional, Callable
|
||||
|
||||
@@ -246,6 +247,50 @@ class QTopPanel(QFrame):
|
||||
mbox.exec_()
|
||||
return True
|
||||
|
||||
def check_valid_autoresolve_settings(self) -> bool:
|
||||
if not self.game.settings.fast_forward_to_first_contact:
|
||||
return True
|
||||
|
||||
if not self.game.settings.auto_resolve_combat:
|
||||
return True
|
||||
|
||||
has_clients = self.ato_has_clients()
|
||||
if (
|
||||
has_clients
|
||||
and self.game.settings.player_mission_interrupts_sim_at is not None
|
||||
):
|
||||
return True
|
||||
|
||||
if has_clients:
|
||||
message = textwrap.dedent(
|
||||
"""\
|
||||
You have enabled settings to fast forward and to auto-resolve combat,
|
||||
but have not selected any interrupt condition. Fast forward will never
|
||||
stop with your current settings. To use auto- resolve, you must choose a
|
||||
"Player missions interrupt fast forward" setting other than "Never".
|
||||
"""
|
||||
)
|
||||
else:
|
||||
message = textwrap.dedent(
|
||||
"""\
|
||||
You have enabled settings to fast forward and to auto-resolve combat,
|
||||
but have no players. Fast forward will never stop with your current
|
||||
settings. Auto-resolve and fast forward cannot be used without player
|
||||
flights and a "Player missions interrupt fast forward" setting other
|
||||
than "Never".
|
||||
"""
|
||||
)
|
||||
|
||||
mbox = QMessageBox(
|
||||
QMessageBox.Icon.Critical,
|
||||
"Incompatible fast-forward settings",
|
||||
message,
|
||||
parent=self,
|
||||
)
|
||||
mbox.setEscapeButton(mbox.addButton(QMessageBox.StandardButton.Close))
|
||||
mbox.exec()
|
||||
return False
|
||||
|
||||
def launch_mission(self):
|
||||
"""Finishes planning and waits for mission completion."""
|
||||
if not self.ato_has_clients() and not self.confirm_no_client_launch():
|
||||
@@ -261,6 +306,9 @@ class QTopPanel(QFrame):
|
||||
if not self.confirm_negative_start_time(negative_starts):
|
||||
return
|
||||
|
||||
if not self.check_valid_autoresolve_settings():
|
||||
return
|
||||
|
||||
if self.game.settings.fast_forward_to_first_contact:
|
||||
with logged_duration("Simulating to first contact"):
|
||||
self.sim_controller.run_to_first_contact()
|
||||
|
||||
Reference in New Issue
Block a user