From 1b000e83dfed075a920703b967e9f2f6a93251eb Mon Sep 17 00:00:00 2001 From: Raffson Date: Sun, 17 Sep 2023 12:25:21 +0200 Subject: [PATCH] Fix "no-purchase" bug at turn 0 --- game/coalition.py | 2 +- game/game.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/game/coalition.py b/game/coalition.py index 900287fc..f142de8b 100644 --- a/game/coalition.py +++ b/game/coalition.py @@ -179,7 +179,7 @@ class Coalition: with logged_duration("Transport planning"): self.transfers.plan_transports() - if not is_turn_0 or not self.game.settings.enable_squadron_aircraft_limits: + if not is_turn_0: self.plan_missions() self.plan_procurement() diff --git a/game/game.py b/game/game.py index 102f037e..53463be0 100644 --- a/game/game.py +++ b/game/game.py @@ -326,7 +326,9 @@ class Game: # TODO: Check for overfull bases. # We don't need to actually stream events for turn zero because we haven't given # *any* state to the UI yet, so it will need to do a full draw once we do. - self.initialize_turn(GameUpdateEvents()) + self.initialize_turn( + GameUpdateEvents(), squadrons_start_full=squadrons_start_full + ) def pass_turn(self, no_action: bool = False) -> None: """Ends the current turn and initializes the new turn. @@ -372,6 +374,7 @@ class Game: events: GameUpdateEvents, for_red: bool = True, for_blue: bool = True, + squadrons_start_full: bool = False, ) -> None: """Performs turn initialization for the specified players. @@ -406,6 +409,7 @@ class Game: events: Game update event container for turn initialization. for_red: True if opfor should be re-initialized. for_blue: True if the player coalition should be re-initialized. + squadrons_start_full: True if generator setting was checked. """ # Check for win or loss condition FIRST! turn_state = self.check_win_loss() @@ -424,9 +428,9 @@ class Game: # Plan Coalition specific turn if for_blue: - self.blue.initialize_turn(self.turn == 0) + self.blue.initialize_turn(self.turn == 0 and squadrons_start_full) if for_red: - self.red.initialize_turn(self.turn == 0) + self.red.initialize_turn(self.turn == 0 and squadrons_start_full) # Plan GroundWar self.ground_planners = {}