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 70a0341675
commit 2926431dc7
5 changed files with 77 additions and 45 deletions

View File

@@ -124,7 +124,6 @@ class QBaseMenu2(QDialog):
self.cp.capture(self.game_model.game, for_player=not self.cp.captured)
# Reinitialized ground planners and the like. The ATO needs to be reset because
# missions planned against the flipped base are no longer valid.
self.game_model.game.reset_ato()
self.game_model.game.initialize_turn()
GameUpdateSignal.get_instance().updateGame(self.game_model.game)

View File

@@ -56,6 +56,5 @@ class QGroundForcesStrategy(QGroupBox):
self.cp.base.affect_strength(amount)
enemy_point.base.affect_strength(-amount)
# Clear the ATO to replan missions affected by the front line.
self.game.reset_ato()
self.game.initialize_turn()
GameUpdateSignal.get_instance().updateGame(self.game)

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):