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

@@ -151,7 +151,7 @@ class FlotGenerator:
utype = AircraftType.named("MQ-9 Reaper")
jtac = self.mission.flight_group(
country=self.mission.country(self.game.blue.country_name),
country=self.game.blue.faction.country,
name=namegen.next_jtac_name(),
aircraft_type=utype.dcs_unit_type,
position=position[0],
@@ -716,7 +716,7 @@ class FlotGenerator:
spawn_heading = (
self.conflict.heading.left if is_player else self.conflict.heading.right
)
country = self.game.coalition_for(is_player).country_name
country = self.game.coalition_for(is_player).faction.country
for group in groups:
if group.role == CombatGroupRole.ARTILLERY:
distance_from_frontline = (
@@ -734,7 +734,7 @@ class FlotGenerator:
g = self._generate_group(
is_player,
self.mission.country(country),
country,
group.unit_type,
group.size,
final_position,
@@ -750,7 +750,7 @@ class FlotGenerator:
self.gen_infantry_group_for_group(
g,
is_player,
self.mission.country(country),
country,
spawn_heading.opposite,
)