Fix swapped list order for purchase priorities.

We were accidentally iterating over the faction list and checking it
against the priority list rather than the other way around, so the
faction's aircraft list was being used for purchase priority rather than
the actual priority list in the game.
This commit is contained in:
Dan Albert 2021-05-18 19:54:39 -07:00
parent a0d9bf0f26
commit c5159f8a87
2 changed files with 2 additions and 1 deletions

View File

@ -9,6 +9,7 @@ Saves from 2.5 are not compatible with 3.0.
* **[Campaign]** Ground units must now be recruited at a base with a factory and transferred to their destination. When buying units in the UI, the purchase will automatically be fulfilled at the closest factory, and a transfer will be created on the next turn.
* **[Campaign AI]** Every 30 minutes the AI will plan a CAP, so players can customize their mission better.
* **[Campaign AI]** AI now considers Ju-88s for CAS, strike, and DEAD missions.
* **[Campaign AI]** Fix purchase of aircraft by priority (the faction's list was being used as the priority list rather than the game's).
* **[UI]** Added new web based map UI. This is mostly functional but many of the old display options are a WIP. Revert to the old map with --old-map.
* **[UI]** Campaigns generated for an older or newer version of the game will now be marked as incompatible. They can still be played, but bugs may be present.
* **[UI]** DCS loadouts are now selectable in the loadout setup menu.

View File

@ -171,7 +171,7 @@ class ProcurementAi:
max_price: float,
) -> Optional[Type[FlyingType]]:
best_choice: Optional[Type[FlyingType]] = None
for unit in [u for u in self.faction.aircrafts if u in types]:
for unit in [u for u in types if u in self.faction.aircrafts]:
if db.PRICES[unit] * number > max_price:
continue
if not airbase.can_operate(unit):