diff --git a/game/db.py b/game/db.py index 23595deb..230f6676 100644 --- a/game/db.py +++ b/game/db.py @@ -2,8 +2,6 @@ from datetime import datetime from enum import Enum from typing import Type -from dcs.countries import country_dict - # mypy can't resolve these if they're wildcard imports for some reason. from dcs.ships import ( CVN_71, @@ -131,13 +129,6 @@ def upgrade_to_supercarrier(unit: Type[ShipType], name: str) -> Type[ShipType]: return unit -def country_id_from_name(name: str) -> int: - for k, v in country_dict.items(): - if v.name == name: - return k - return -1 - - class DefaultLiveries: class Default(Enum): af_standard = "" diff --git a/game/missiongenerator/missiongenerator.py b/game/missiongenerator/missiongenerator.py index 8836f1e9..5511fba0 100644 --- a/game/missiongenerator/missiongenerator.py +++ b/game/missiongenerator/missiongenerator.py @@ -10,7 +10,6 @@ from dcs import Mission, Point from dcs.coalition import Coalition from dcs.countries import country_dict -from game import db from game.dcs.helpers import unit_type_from_name from game.missiongenerator.aircraft.aircraftgenerator import ( AircraftGenerator, @@ -48,6 +47,13 @@ if TYPE_CHECKING: COMBINED_ARMS_SLOTS = 1 +def country_id_from_name(name: str) -> int: + for k, v in country_dict.items(): + if v.name == name: + return k + return -1 + + class MissionGenerator: def __init__(self, game: Game, time: datetime) -> None: self.game = game @@ -129,15 +135,15 @@ class MissionGenerator: p_country = self.game.blue.country_name e_country = self.game.red.country_name self.mission.coalition["blue"].add_country( - country_dict[db.country_id_from_name(p_country)]() + country_dict[country_id_from_name(p_country)]() ) self.mission.coalition["red"].add_country( - country_dict[db.country_id_from_name(e_country)]() + country_dict[country_id_from_name(e_country)]() ) belligerents = [ - db.country_id_from_name(p_country), - db.country_id_from_name(e_country), + country_id_from_name(p_country), + country_id_from_name(e_country), ] for country in country_dict.keys(): if country not in belligerents: