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

@@ -10,12 +10,12 @@ router: APIRouter = APIRouter(prefix="/front-lines")
@router.get("/")
def list_front_lines(game: Game = Depends(GameContext.get)) -> list[FrontLineJs]:
return [FrontLineJs.for_front_line(f) for f in game.theater.conflicts()]
def list_front_lines(game: Game = Depends(GameContext.require)) -> list[FrontLineJs]:
return FrontLineJs.all_in_game(game)
@router.get("/{front_line_id}")
def get_front_line(
front_line_id: UUID, game: Game = Depends(GameContext.get)
front_line_id: UUID, game: Game = Depends(GameContext.require)
) -> FrontLineJs:
return FrontLineJs.for_front_line(game.db.front_lines.get(front_line_id))