diff --git a/game/theater/conflicttheater.py b/game/theater/conflicttheater.py index 893371bd..8f6ab030 100644 --- a/game/theater/conflicttheater.py +++ b/game/theater/conflicttheater.py @@ -64,33 +64,6 @@ IMPORTANCE_LOW = 1 IMPORTANCE_MEDIUM = 1.2 IMPORTANCE_HIGH = 1.4 -""" -ALL_RADIALS = [0, 45, 90, 135, 180, 225, 270, 315, ] -COAST_NS_E = [45, 90, 135, ] -COAST_EW_N = [315, 0, 45, ] -COAST_NSEW_E = [225, 270, 315, ] -COAST_NSEW_W = [45, 90, 135, ] - -COAST_NS_W = [225, 270, 315, ] -COAST_EW_S = [135, 180, 225, ] -""" - -LAND = [0, 45, 90, 135, 180, 225, 270, 315, ] - -COAST_V_E = [0, 45, 90, 135, 180] -COAST_V_W = [180, 225, 270, 315, 0] - -COAST_A_W = [315, 0, 45, 135, 180, 225, 270] -COAST_A_E = [0, 45, 90, 135, 180, 225, 315] - -COAST_H_N = [270, 315, 0, 45, 90] -COAST_H_S = [90, 135, 180, 225, 270] - -COAST_DL_E = [45, 90, 135, 180, 225] -COAST_DL_W = [225, 270, 315, 0, 45] -COAST_DR_E = [315, 0, 45, 90, 135] -COAST_DR_W = [135, 180, 225, 315] - FRONTLINE_MIN_CP_DISTANCE = 5000 def pairwise(iterable): @@ -151,8 +124,6 @@ class MizCampaignLoader: @staticmethod def control_point_from_airport(airport: Airport) -> ControlPoint: - # TODO: Radials? - radials = LAND # The wiki says this is a legacy property and to just use regular. size = SIZE_REGULAR @@ -166,7 +137,7 @@ class MizCampaignLoader: else: importance = airport.periodicity / 10 - cp = Airfield(airport, radials, size, importance) + cp = Airfield(airport, size, importance) cp.captured = airport.is_blue() # Use the unlimited aircraft option to determine if an airfield should @@ -514,11 +485,6 @@ class ConflictTheater: airbase = theater.terrain.airports[p["id"]] - if "radials" in p.keys(): - radials = p["radials"] - else: - radials = LAND - if "size" in p.keys(): size = p["size"] else: @@ -529,7 +495,7 @@ class ConflictTheater: else: importance = IMPORTANCE_MEDIUM - cp = Airfield(airbase, radials, size, importance) + cp = Airfield(airbase, size, importance) elif p["type"] == "carrier": cp = Carrier("carrier", Point(p["x"], p["y"]), p["id"]) else: diff --git a/game/theater/controlpoint.py b/game/theater/controlpoint.py index 6a714acf..3c45193a 100644 --- a/game/theater/controlpoint.py +++ b/game/theater/controlpoint.py @@ -156,11 +156,10 @@ class ControlPoint(MissionTarget, ABC): alt = 0 # TODO: Only airbases have IDs. - # TODO: Radials seem to be pointless. # TODO: has_frontline is only reasonable for airbases. # TODO: cptype is obsolete. def __init__(self, cp_id: int, name: str, position: Point, - at: db.StartingPosition, radials: List[int], size: int, + at: db.StartingPosition, size: int, importance: float, has_frontline=True, cptype=ControlPointType.AIRBASE): super().__init__(" ".join(re.split(r"[ \-]", name)[:2]), position) @@ -179,7 +178,6 @@ class ControlPoint(MissionTarget, ABC): self.captured_invert = False # TODO: Should be Airbase specific. self.has_frontline = has_frontline - self.radials = radials self.connected_points: List[ControlPoint] = [] self.base: Base = Base() self.cptype = cptype @@ -228,16 +226,6 @@ class ControlPoint(MissionTarget, ABC): """ return False - @property - def sea_radials(self) -> List[int]: - # TODO: fix imports - all_radials = [0, 45, 90, 135, 180, 225, 270, 315, ] - result = [] - for r in all_radials: - if r not in self.radials: - result.append(r) - return result - @property @abstractmethod def total_aircraft_parking(self): @@ -287,17 +275,6 @@ class ControlPoint(MissionTarget, ABC): def is_connected(self, to) -> bool: return to in self.connected_points - def find_radial(self, heading: int, ignored_radial: int = None) -> int: - closest_radial = 0 - closest_radial_delta = 360 - for radial in [x for x in self.radials if x != ignored_radial]: - delta = abs(radial - heading) - if delta < closest_radial_delta: - closest_radial = radial - closest_radial_delta = delta - - return closest_radial - def find_ground_objects_by_obj_name(self, obj_name): found = [] for g in self.ground_objects: @@ -390,10 +367,10 @@ class ControlPoint(MissionTarget, ABC): class Airfield(ControlPoint): - def __init__(self, airport: Airport, radials: List[int], size: int, + def __init__(self, airport: Airport, size: int, importance: float, has_frontline=True): super().__init__(airport.id, airport.name, airport.position, airport, - radials, size, importance, has_frontline, + size, importance, has_frontline, cptype=ControlPointType.AIRBASE) self.airport = airport @@ -481,7 +458,7 @@ class Carrier(NavalControlPoint): def __init__(self, name: str, at: Point, cp_id: int): import game.theater.conflicttheater - super().__init__(cp_id, name, at, at, game.theater.conflicttheater.LAND, + super().__init__(cp_id, name, at, at, game.theater.conflicttheater.SIZE_SMALL, 1, has_frontline=False, cptype=ControlPointType.AIRCRAFT_CARRIER_GROUP) @@ -505,7 +482,7 @@ class Lha(NavalControlPoint): def __init__(self, name: str, at: Point, cp_id: int): import game.theater.conflicttheater - super().__init__(cp_id, name, at, at, game.theater.conflicttheater.LAND, + super().__init__(cp_id, name, at, at, game.theater.conflicttheater.SIZE_SMALL, 1, has_frontline=False, cptype=ControlPointType.LHA_GROUP) @@ -531,7 +508,7 @@ class OffMapSpawn(ControlPoint): def __init__(self, cp_id: int, name: str, position: Point): from . import IMPORTANCE_MEDIUM, SIZE_REGULAR - super().__init__(cp_id, name, position, at=position, radials=[], + super().__init__(cp_id, name, position, at=position, size=SIZE_REGULAR, importance=IMPORTANCE_MEDIUM, has_frontline=False, cptype=ControlPointType.OFF_MAP)