Use the actual Country type instead of the name.

We want other pieces of country information (in particular the short
names). This cleans up a lot of code anyway.

As an added bonus, this now catches squadrons that used invalid names
which would previously be passed through to pydcs and... then I don't
know what would happen.
This commit is contained in:
Dan Albert
2023-05-12 17:59:51 -07:00
parent 752a90cddb
commit bd2ec12e0f
23 changed files with 63 additions and 78 deletions

View File

@@ -7,6 +7,7 @@ from dataclasses import dataclass, field
from datetime import datetime
from typing import Optional, Sequence, TYPE_CHECKING
from dcs.country import Country
from faker import Faker
from game.ato import Flight, FlightType, Package
@@ -28,7 +29,7 @@ if TYPE_CHECKING:
class Squadron:
name: str
nickname: Optional[str]
country: str
country: Country
role: str
aircraft: AircraftType
max_size: int
@@ -71,7 +72,7 @@ class Squadron:
(
self.name,
self.nickname,
self.country,
self.country.id,
self.role,
self.aircraft,
)
@@ -418,7 +419,6 @@ class Squadron:
flight = Flight(
package,
self.coalition.country_name,
self,
size,
FlightType.FERRY,