replan opfor mission on sell or buy of tgos

(cherry picked from commit 7229b886e0)
This commit is contained in:
RndName
2021-06-24 19:06:32 +02:00
committed by Dan Albert
parent ec15c37332
commit 40092bf87f
5 changed files with 77 additions and 45 deletions

View File

@@ -259,6 +259,14 @@ class QGroundObjectMenu(QDialog):
self.update_total_value()
self.game.budget = self.game.budget + self.total_value
self.ground_object.groups = []
# Replan if the tgo was a target of the redfor
if any(
package.target == self.ground_object
for package in self.game.ato_for(player=False).packages
):
self.game.initialize_turn(for_red=True, for_blue=False)
self.do_refresh_layout()
GameUpdateSignal.get_instance().updateGame(self.game)
@@ -439,6 +447,9 @@ class QBuyGroupForGroundObjectDialog(QDialog):
)
self.ground_object.groups = [group]
# Replan redfor missions
self.game.initialize_turn(for_red=True, for_blue=False)
GameUpdateSignal.get_instance().updateGame(self.game)
def buySam(self):
@@ -452,6 +463,9 @@ class QBuyGroupForGroundObjectDialog(QDialog):
self.ground_object.groups = list(sam_generator.groups)
# Replan redfor missions
self.game.initialize_turn(for_red=True, for_blue=False)
GameUpdateSignal.get_instance().updateGame(self.game)
def buy_ewr(self):
@@ -465,6 +479,9 @@ class QBuyGroupForGroundObjectDialog(QDialog):
self.ground_object.groups = [ewr_generator.vg]
# Replan redfor missions
self.game.initialize_turn(for_red=True, for_blue=False)
GameUpdateSignal.get_instance().updateGame(self.game)
def error_money(self):