mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Attempt to reset the simulation on abort.
This is optional because I really don't know if I trust it. I don't see much wrong with it (aside from the warning about not using it with auto- resolve, because it won't restore lost aircraft), but it's really not something I'd built for since it's not going to be possible as the RTS features grow. Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2735.
This commit is contained in:
@@ -84,6 +84,9 @@ class SimController(QObject):
|
||||
with self.game_loop.paused_sim():
|
||||
yield
|
||||
|
||||
def reset_simulation(self) -> None:
|
||||
self.game_loop.reset()
|
||||
|
||||
def run_to_first_contact(self) -> None:
|
||||
self.game_loop.run_to_first_contact()
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ class QWaitingForMissionResultWindow(QDialog):
|
||||
self.manually_submit.clicked.connect(self.submit_manually)
|
||||
self.actions_layout.addWidget(self.manually_submit)
|
||||
self.cancel = QPushButton("Abort mission")
|
||||
self.cancel.clicked.connect(self.close)
|
||||
self.cancel.clicked.connect(self.reject)
|
||||
self.actions_layout.addWidget(self.cancel)
|
||||
self.gridLayout.addWidget(self.actions, 2, 0)
|
||||
|
||||
@@ -122,7 +122,7 @@ class QWaitingForMissionResultWindow(QDialog):
|
||||
self.manually_submit2.clicked.connect(self.submit_manually)
|
||||
self.actions2_layout.addWidget(self.manually_submit2)
|
||||
self.cancel2 = QPushButton("Abort mission")
|
||||
self.cancel2.clicked.connect(self.close)
|
||||
self.cancel2.clicked.connect(self.reject)
|
||||
self.actions2_layout.addWidget(self.cancel2)
|
||||
self.proceed = QPushButton("Accept results")
|
||||
self.proceed.setProperty("style", "btn-success")
|
||||
@@ -133,6 +133,11 @@ class QWaitingForMissionResultWindow(QDialog):
|
||||
self.layout.addLayout(self.gridLayout, 1, 0)
|
||||
self.setLayout(self.layout)
|
||||
|
||||
def reject(self) -> None:
|
||||
if self.game.settings.reset_simulation_on_abort:
|
||||
self.sim_controller.reset_simulation()
|
||||
super().reject()
|
||||
|
||||
@staticmethod
|
||||
def add_update_row(description: str, count: int, layout: QGridLayout) -> None:
|
||||
row = layout.rowCount()
|
||||
@@ -217,7 +222,7 @@ class QWaitingForMissionResultWindow(QDialog):
|
||||
|
||||
GameUpdateSignal.get_instance().sendDebriefing(self.debriefing)
|
||||
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||
self.close()
|
||||
self.accept()
|
||||
|
||||
def closeEvent(self, evt):
|
||||
super(QWaitingForMissionResultWindow, self).closeEvent(evt)
|
||||
|
||||
Reference in New Issue
Block a user