mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fixup auto-assignable tasks when limits change.
The air wing config was fixing the main `mission_types` field, but the `auto_assignable_mission_types` property had already been set. Update that field whenever the `mission_types` are changed. Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1515
This commit is contained in:
parent
def5454e5f
commit
91daabc9d2
@ -4,7 +4,7 @@ import dataclasses
|
||||
import itertools
|
||||
import logging
|
||||
import random
|
||||
from collections import defaultdict
|
||||
from collections import defaultdict, Iterable
|
||||
from dataclasses import dataclass, field
|
||||
from enum import unique, Enum
|
||||
from pathlib import Path
|
||||
@ -146,6 +146,10 @@ class Squadron:
|
||||
def pilot_limits_enabled(self) -> bool:
|
||||
return self.settings.enable_squadron_pilot_limits
|
||||
|
||||
def set_allowed_mission_types(self, mission_types: Iterable[FlightType]) -> None:
|
||||
self.mission_types = tuple(mission_types)
|
||||
self.auto_assignable_mission_types.intersection_update(self.mission_types)
|
||||
|
||||
def claim_new_pilot_if_allowed(self) -> Optional[Pilot]:
|
||||
if self.pilot_limits_enabled:
|
||||
return None
|
||||
|
||||
@ -158,7 +158,9 @@ class SquadronConfigurationBox(QGroupBox):
|
||||
self.squadron.pilot_pool = [
|
||||
Pilot(n, player=True) for n in player_names
|
||||
] + self.squadron.pilot_pool
|
||||
self.squadron.mission_types = tuple(self.allowed_missions.allowed_mission_types)
|
||||
self.squadron.set_allowed_mission_types(
|
||||
self.allowed_missions.allowed_mission_types
|
||||
)
|
||||
return self.squadron
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user