mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Fix current_airlift_capacity always returning 0.
Squadron.aircraft is of type AircraftType, while TRANSPORT_CAPABLE is a list of pydcs DcsUnitTypes. As a result, the intersection was always empty causing the function to always return 0.
This commit is contained in:
parent
7e17533cc6
commit
bb2bf78e8a
@ -368,9 +368,9 @@ class AirWing:
|
|||||||
def squadrons_for(self, aircraft: AircraftType) -> Sequence[Squadron]:
|
def squadrons_for(self, aircraft: AircraftType) -> Sequence[Squadron]:
|
||||||
return self.squadrons[aircraft]
|
return self.squadrons[aircraft]
|
||||||
|
|
||||||
def squadrons_for_task(self, task: FlightType) -> Iterator[Squadron]:
|
def auto_assignable_for_task(self, task: FlightType) -> Iterator[Squadron]:
|
||||||
for squadron in self.iter_squadrons():
|
for squadron in self.iter_squadrons():
|
||||||
if task in squadron.mission_types:
|
if squadron.can_auto_assign(task):
|
||||||
yield squadron
|
yield squadron
|
||||||
|
|
||||||
def auto_assignable_for_task_with_type(
|
def auto_assignable_for_task_with_type(
|
||||||
|
|||||||
@ -600,10 +600,10 @@ class PendingTransfers:
|
|||||||
|
|
||||||
def current_airlift_capacity(self, control_point: ControlPoint) -> int:
|
def current_airlift_capacity(self, control_point: ControlPoint) -> int:
|
||||||
inventory = self.game.aircraft_inventory.for_control_point(control_point)
|
inventory = self.game.aircraft_inventory.for_control_point(control_point)
|
||||||
squadrons = self.game.air_wing_for(control_point.captured).squadrons_for_task(
|
squadrons = self.game.air_wing_for(
|
||||||
FlightType.TRANSPORT
|
control_point.captured
|
||||||
)
|
).auto_assignable_for_task(FlightType.TRANSPORT)
|
||||||
unit_types = {s.aircraft for s in squadrons}.intersection(TRANSPORT_CAPABLE)
|
unit_types = {s.aircraft for s in squadrons}
|
||||||
return sum(
|
return sum(
|
||||||
count
|
count
|
||||||
for unit_type, count in inventory.all_aircraft
|
for unit_type, count in inventory.all_aircraft
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user