fix a bug with parking allocation

This commit is contained in:
Eclipse/Druss99 2025-10-12 13:33:21 -04:00 committed by Raffson
parent 96f940bc59
commit cf575fba2a
3 changed files with 20 additions and 2 deletions

View File

@ -26,6 +26,7 @@
* **[Plugins]** EW Script - Fix radar detection routine. * **[Plugins]** EW Script - Fix radar detection routine.
* **[Campaign]** Fixed a bug where sinking a destroyer in a carrier group would cause squadrons to be removed from the carrier * **[Campaign]** Fixed a bug where sinking a destroyer in a carrier group would cause squadrons to be removed from the carrier
* **[Engine]** Fixed a bug with transfers to Helipads * **[Engine]** Fixed a bug with transfers to Helipads
* **[Engine]** Fixed a bug with parking allocation
# Retribution v1.4.1 (hotfix) # Retribution v1.4.1 (hotfix)

View File

@ -104,6 +104,23 @@ class AircraftGenerator:
for parking_slot in cp.parking_slots: for parking_slot in cp.parking_slots:
parking_slot.unit_id = None parking_slot.unit_id = None
def _prioritized_packages(self, ato: AirTaskingOrder) -> List[Package]:
"""Returns the packages in the order they should be generated."""
return sorted(
ato.packages,
key=lambda p: (
(
1
if any(
f.flight_type in [FlightType.AEWC, FlightType.REFUELING]
for f in p.flights
)
else 0
),
p.time_over_target,
),
)
def generate_flights( def generate_flights(
self, self,
country: Country, country: Country,
@ -124,7 +141,7 @@ class AircraftGenerator:
self._reserve_frequencies_and_tacan(ato) self._reserve_frequencies_and_tacan(ato)
self.mission_data.packages.clear() self.mission_data.packages.clear()
for package in reversed(sorted(ato.packages, key=lambda x: x.time_over_target)): for package in reversed(self._prioritized_packages(ato)):
logging.info(f"Generating package for target: {package.target.name}") logging.info(f"Generating package for target: {package.target.name}")
if not package.flights: if not package.flights:
continue continue

View File

@ -33,7 +33,7 @@ pluggy==1.5.0
pre-commit==4.2.0 pre-commit==4.2.0
pydantic==2.11.0b2 pydantic==2.11.0b2
pydantic-settings==2.8.1 pydantic-settings==2.8.1
pydcs @ git+https://github.com/dcs-retribution/pydcs@f50627d79c1b24786139eed3a35329d55a03cef5 pydcs @ git+https://github.com/dcs-retribution/pydcs@60cddd944d454f59f5c866a2ec2ae3e91526da25
pyinstaller==5.13.2 pyinstaller==5.13.2
pyinstaller-hooks-contrib==2024.0 pyinstaller-hooks-contrib==2024.0
pyparsing==3.2.1 pyparsing==3.2.1