Streamlining

This commit is contained in:
Raffson 2023-10-07 17:29:44 +02:00
parent 3499ba5ffa
commit c50dcaaafb
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
7 changed files with 17 additions and 11 deletions

View File

@ -24,5 +24,5 @@ class Builder(FormationAttackBuilder[SeadSweepFlightPlan, FormationAttackLayout]
def layout(self) -> FormationAttackLayout:
return self._build(FlightWaypointType.INGRESS_SEAD_SWEEP)
def build(self) -> SeadSweepFlightPlan:
def build(self, dump_debug_info: bool = False) -> SeadSweepFlightPlan:
return SeadSweepFlightPlan(self.flight, self.layout())

View File

@ -297,7 +297,9 @@ class AircraftType(UnitType[Type[FlyingType]]):
else:
# Slow like warbirds or helicopters
# Use whichever is slowest - mach 0.35 or 50% of max speed
logging.debug(f"{self.display_name} max_speed * 0.5 is {max_speed * 0.5}")
logging.debug(
f"{self.display_name} max_speed * 0.5 is {max_speed * 0.5}"
)
return min(Speed.from_mach(0.35, altitude), max_speed * 0.5)
def alloc_flight_radio(self, radio_registry: RadioRegistry) -> RadioFrequency:
@ -362,11 +364,17 @@ class AircraftType(UnitType[Type[FlyingType]]):
state.update(updated.__dict__)
self.__dict__.update(state)
@staticmethod
def _migrator() -> Dict[str, str]:
return {
"F-15E Strike Eagle (AI)": "F-15E Strike Eagle"
}
@classmethod
def named(cls, name: str) -> AircraftType:
if not cls._loaded:
cls._load_all()
return cls._by_name[name]
return cls._by_name[cls._migrator().get(name, name)]
@classmethod
def for_dcs_type(cls, dcs_unit_type: Type[FlyingType]) -> Iterator[AircraftType]:
@ -422,7 +430,6 @@ class AircraftType(UnitType[Type[FlyingType]]):
def _variant_from_dict(
cls, aircraft: Type[FlyingType], variant_id: str, data: dict[str, Any]
) -> AircraftType:
try:
price = data["price"]
except KeyError as ex:

View File

@ -541,7 +541,7 @@ class Faction:
def remove_aircraft_by_name(self, name: str) -> None:
for i in list(self.aircrafts):
if i.name == name:
if i.display_name == name:
self.aircrafts.remove(i)
def remove_preset(self, name: str) -> None:

View File

@ -119,7 +119,6 @@ class RequirementBuilder:
def maximum_turn_to(
self, turn_point: Point, next_point: Point, turn_limit: Heading
) -> None:
large_distance = nautical_miles(400)
next_heading = Heading.from_degrees(
angle_between_points(next_point, turn_point)

View File

@ -61,7 +61,7 @@ class Migrator:
for c in self.game.coalitions:
for p in c.ato.packages:
if p.waypoints and not hasattr(p.waypoints, "initial"):
p.waypoints = PackageWaypoints.create(p, c)
p.waypoints = PackageWaypoints.create(p, c, False)
def _update_package_attributes(self) -> None:
for c in self.game.coalitions:

View File

@ -31,10 +31,10 @@ class QFactionUnits(QScrollArea):
def _add_checkboxes(self, units: set, counter: int, grid: QGridLayout) -> int:
counter += 1
for i, v in enumerate(sorted(units, key=lambda x: x.name), counter):
cb = QCheckBox(v.name)
for i, v in enumerate(sorted(units, key=lambda x: str(x)), counter):
cb = QCheckBox(str(v))
cb.setCheckState(Qt.CheckState.Checked)
self.checkboxes[v.name] = cb
self.checkboxes[str(v)] = cb
grid.addWidget(cb, i, 1)
counter += 1
counter += 1

View File

@ -86,7 +86,7 @@ def capture_fuzz_failures(solver: IpSolver) -> Iterator[None]:
WaypointSolverTestCaseReducer(
solver.debug_output_directory, test_case_directory
).reduce()
ex.add_note(f"Reduced test case was written to {test_case_directory}")
ex.add_note(f"Reduced test case was written to {test_case_directory}") # type: ignore
raise