Handle map reset when the game is loaded/unloaded.

https://github.com/dcs-liberation/dcs_liberation/issues/2039

Partial fix for
https://github.com/dcs-liberation/dcs_liberation/issues/2045 (now works
in the new map, old one not fixed yet).
This commit is contained in:
Dan Albert
2022-03-05 18:02:46 -08:00
parent 995e28cb32
commit 73fcfcec7b
37 changed files with 403 additions and 178 deletions

View File

@@ -17,7 +17,11 @@ class GameContext:
cls._game_model = game_model
@classmethod
def get(cls) -> Game:
def get(cls) -> Game | None:
return cls._game_model.game
@classmethod
def require(cls) -> Game:
if cls._game_model.game is None:
raise RuntimeError("GameContext has no Game set")
return cls._game_model.game