From 8ca68b3d7aa4ab2dc3c923406b7fc0e6a40345db Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Sat, 10 Apr 2021 15:44:57 -0700 Subject: [PATCH] Set win/loss status for functioning airfields. "Fixes" https://github.com/Khopa/dcs_liberation/issues/833. The crash is still present, but we're at least telling the player that the game is over so they shouldn't try to play. The UX for this sucks (https://github.com/Khopa/dcs_liberation/issues/978), but it's the same as other end-game states. --- game/game.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/game/game.py b/game/game.py index e41ae125..22598504 100644 --- a/game/game.py +++ b/game/game.py @@ -284,11 +284,18 @@ class Game: persistency.autosave(self) def check_win_loss(self): - captured_states = {i.captured for i in self.theater.controlpoints} - if True not in captured_states: + player_airbases = { + cp for cp in self.theater.player_points() if cp.runway_is_operational() + } + if not player_airbases: return TurnState.LOSS - if False not in captured_states: + + enemy_airbases = { + cp for cp in self.theater.enemy_points() if cp.runway_is_operational() + } + if not enemy_airbases: return TurnState.WIN + return TurnState.CONTINUE def initialize_turn(self) -> None: