persistent time and weather between regular and quick missions; defense AA for frontline CAS

This commit is contained in:
Vasyl Horbachenko
2018-06-29 00:20:56 +03:00
parent f8c1956614
commit 2ace05c565
12 changed files with 41 additions and 24 deletions

View File

@@ -3,22 +3,24 @@ import pickle
import os
import shutil
from game.game import Game
def _save_file() -> str:
return "build/save"
return os.path.expanduser("~\Saved Games\DCS\liberation_save")
def _temporary_save_file() -> str:
return "build/save_tmp"
return os.path.expanduser("~\Saved Games\DCS\liberation_save_tmp")
def _save_file_exists() -> bool:
return os.path.exists(_save_file())
def restore_game() -> typing.Optional[Game]:
def mission_path_for(name: str) -> str:
return os.path.expanduser("~\Saved Games\DCS\Missions\{}".format(name))
def restore_game():
if not _save_file_exists():
return None
@@ -30,7 +32,7 @@ def restore_game() -> typing.Optional[Game]:
return None
def save_game(game: Game) -> bool:
def save_game(game) -> bool:
try:
with open(_temporary_save_file(), "wb") as f:
pickle.dump(game, f)