diff --git a/game/missiongenerator/flotgenerator.py b/game/missiongenerator/flotgenerator.py index 51ae5d26..8d9a3319 100644 --- a/game/missiongenerator/flotgenerator.py +++ b/game/missiongenerator/flotgenerator.py @@ -206,10 +206,6 @@ class FlotGenerator: if not infantry_position: logging.warning("Could not find infantry position") return - if side == self.conflict.attackers_country: - cp = self.conflict.blue_cp - else: - cp = self.conflict.red_cp faction = self.game.faction_for(is_player) @@ -739,6 +735,7 @@ class FlotGenerator: if final_position is not None: g = self._generate_group( + is_player, self.mission.country(country), group.unit_type, group.size, @@ -765,19 +762,14 @@ class FlotGenerator: def _generate_group( self, + player: bool, side: Country, unit_type: GroundUnitType, count: int, at: Point, - move_formation: PointAction = PointAction.OffRoad, - heading: Heading = Heading.from_degrees(0), + heading: Heading, ) -> VehicleGroup: - - if side == self.conflict.attackers_country: - cp = self.conflict.blue_cp - else: - cp = self.conflict.red_cp - + cp = self.conflict.front_line.control_point_friendly_to(player) group = self.mission.vehicle_group( side, namegen.next_unit_name(side, unit_type), @@ -785,7 +777,6 @@ class FlotGenerator: position=at, group_size=count, heading=heading.degrees, - move_formation=move_formation, ) self.unit_map.add_front_line_units(group, cp, unit_type) diff --git a/game/missiongenerator/frontlineconflictdescription.py b/game/missiongenerator/frontlineconflictdescription.py index 36f5c2ea..9d5a8b0a 100644 --- a/game/missiongenerator/frontlineconflictdescription.py +++ b/game/missiongenerator/frontlineconflictdescription.py @@ -4,7 +4,6 @@ import logging from dataclasses import dataclass from typing import Optional, Tuple -from dcs.country import Country from dcs.mapping import Point from shapely.geometry import LineString, Point as ShapelyPoint @@ -27,19 +26,10 @@ class FrontLineConflictDescription: self, theater: ConflictTheater, front_line: FrontLine, - attackers_side: str, - defenders_side: str, - attackers_country: Country, - defenders_country: Country, position: Point, heading: Optional[Heading] = None, size: Optional[int] = None, ): - self.attackers_side = attackers_side - self.defenders_side = defenders_side - self.attackers_country = attackers_country - self.defenders_country = defenders_country - self.front_line = front_line self.theater = theater self.position = position @@ -54,10 +44,6 @@ class FrontLineConflictDescription: def red_cp(self) -> ControlPoint: return self.front_line.red_cp - @classmethod - def has_frontline_between(cls, from_cp: ControlPoint, to_cp: ControlPoint) -> bool: - return from_cp.has_frontline and to_cp.has_frontline - @classmethod def frontline_position( cls, frontline: FrontLine, theater: ConflictTheater @@ -94,28 +80,17 @@ class FrontLineConflictDescription: @classmethod def frontline_cas_conflict( - cls, - attacker_name: str, - defender_name: str, - attacker: Country, - defender: Country, - front_line: FrontLine, - theater: ConflictTheater, + cls, front_line: FrontLine, theater: ConflictTheater ) -> FrontLineConflictDescription: - assert cls.has_frontline_between(front_line.blue_cp, front_line.red_cp) # TODO: Break apart the front-line and air conflict descriptions. # We're wastefully not caching the front-line bounds here because air conflicts # can't compute bounds, only a position. bounds = cls.frontline_bounds(front_line, theater) - conflict = cls( + conflict = FrontLineConflictDescription( position=bounds.left_position, heading=bounds.heading_from_left_to_right, theater=theater, front_line=front_line, - attackers_side=attacker_name, - defenders_side=defender_name, - attackers_country=attacker, - defenders_country=defender, size=bounds.length, ) return conflict diff --git a/game/missiongenerator/missiongenerator.py b/game/missiongenerator/missiongenerator.py index 7b63fdfc..ee01b71c 100644 --- a/game/missiongenerator/missiongenerator.py +++ b/game/missiongenerator/missiongenerator.py @@ -196,12 +196,7 @@ class MissionGenerator: player_cp = front_line.blue_cp enemy_cp = front_line.red_cp conflict = FrontLineConflictDescription.frontline_cas_conflict( - self.game.blue.faction.name, - self.game.red.faction.name, - self.mission.country(self.game.blue.country_name), - self.mission.country(self.game.red.country_name), - front_line, - self.game.theater, + front_line, self.game.theater ) # Generate frontline ops player_gp = self.game.ground_planners[player_cp.id].units_per_cp[