diff --git a/client/src/api/actions.ts b/client/src/api/actions.ts index 003ad2bc..3edbaeef 100644 --- a/client/src/api/actions.ts +++ b/client/src/api/actions.ts @@ -1,4 +1,4 @@ -import Game from "./game"; +import { Game } from "./liberationApi"; import { createAction } from "@reduxjs/toolkit"; export const gameLoaded = createAction("game/loaded"); diff --git a/client/src/api/game.ts b/client/src/api/game.ts deleted file mode 100644 index 63c88285..00000000 --- a/client/src/api/game.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { - ControlPoint, - Flight, - FrontLine, - NavMeshes, - SupplyRoute, - Tgo, - ThreatZoneContainer, -} from "./liberationApi"; -import { LatLngLiteral } from "leaflet"; - -export default interface Game { - control_points: ControlPoint[]; - tgos: Tgo[]; - supply_routes: SupplyRoute[]; - front_lines: FrontLine[]; - flights: Flight[]; - threat_zones: ThreatZoneContainer; - navmeshes: NavMeshes; - map_center: LatLngLiteral | null; -} diff --git a/client/src/api/gamestate.ts b/client/src/api/gamestate.ts index 25fe3f48..84937f0e 100644 --- a/client/src/api/gamestate.ts +++ b/client/src/api/gamestate.ts @@ -1,7 +1,7 @@ import { AppDispatch } from "../app/store"; import { gameLoaded, gameUnloaded } from "./actions"; import backend from "./backend"; -import Game from "./game"; +import { Game } from "./liberationApi"; export default function reloadGameState( dispatch: AppDispatch, @@ -17,7 +17,7 @@ export default function reloadGameState( } const game = response.data as Game; if (ignoreRecenter) { - game.map_center = null; + game.map_center = undefined; } dispatch(gameLoaded(game)); }); diff --git a/client/src/api/liberationApi.ts b/client/src/api/liberationApi.ts index cef3113d..295554ab 100644 --- a/client/src/api/liberationApi.ts +++ b/client/src/api/liberationApi.ts @@ -443,7 +443,7 @@ export type Game = { flights: Flight[]; threat_zones: ThreatZoneContainer; navmeshes: NavMeshes; - map_center: LatLng; + map_center?: LatLng; }; export type MapZones = { inclusion: LatLng[][]; diff --git a/game/server/game/models.py b/game/server/game/models.py index 3ac7ad36..ec7c0e47 100644 --- a/game/server/game/models.py +++ b/game/server/game/models.py @@ -25,7 +25,7 @@ class GameJs(BaseModel): flights: list[FlightJs] threat_zones: ThreatZoneContainerJs navmeshes: NavMeshesJs - map_center: LeafletPoint + map_center: LeafletPoint | None class Config: title = "Game"