Type check the contents of untyped functions.

By default mypy doesn't type check the code within an untyped function.
This enables that and fixes typing errors to accomodate it.

This did uncover a very old bug:
https://github.com/dcs-liberation/dcs_liberation/issues/1417
This commit is contained in:
Dan Albert
2021-07-07 15:47:19 -07:00
parent 299ed88f09
commit fc32b98341
5 changed files with 15 additions and 20 deletions

View File

@@ -136,6 +136,7 @@ class GroundConflictGenerator:
position = Conflict.frontline_position(
self.conflict.front_line, self.game.theater
)
frontline_vector = Conflict.frontline_vector(
self.conflict.front_line, self.game.theater
)
@@ -150,6 +151,13 @@ class GroundConflictGenerator:
self.enemy_planned_combat_groups, frontline_vector, False
)
# TODO: Differentiate AirConflict and GroundConflict classes.
if self.conflict.heading is None:
raise RuntimeError(
"Cannot generate ground units for non-ground conflict. Ground unit "
"conflicts cannot have the heading `None`."
)
# Plan combat actions for groups
self.plan_action_for_groups(
self.player_stance,
@@ -174,7 +182,7 @@ class GroundConflictGenerator:
code = 1688 - len(self.jtacs)
utype = self.game.player_faction.jtac_unit
if self.game.player_faction.jtac_unit is None:
if utype is None:
utype = AircraftType.named("MQ-9 Reaper")
jtac = self.mission.flight_group(