mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
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.
This commit is contained in:
parent
0f76d893b8
commit
8ca68b3d7a
13
game/game.py
13
game/game.py
@ -284,11 +284,18 @@ class Game:
|
|||||||
persistency.autosave(self)
|
persistency.autosave(self)
|
||||||
|
|
||||||
def check_win_loss(self):
|
def check_win_loss(self):
|
||||||
captured_states = {i.captured for i in self.theater.controlpoints}
|
player_airbases = {
|
||||||
if True not in captured_states:
|
cp for cp in self.theater.player_points() if cp.runway_is_operational()
|
||||||
|
}
|
||||||
|
if not player_airbases:
|
||||||
return TurnState.LOSS
|
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.WIN
|
||||||
|
|
||||||
return TurnState.CONTINUE
|
return TurnState.CONTINUE
|
||||||
|
|
||||||
def initialize_turn(self) -> None:
|
def initialize_turn(self) -> None:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user