From b958e9b0958216bc7d56f420a31e82396a1be452 Mon Sep 17 00:00:00 2001 From: Raffson Date: Sun, 28 May 2023 14:28:41 +0200 Subject: [PATCH] Avoid overpopulating bases With the new aircraft limitations for squadrons, airfields/fobs/farps could get overpopulated at campaign start. This would cause all sorts of gnarly things like squadrons ending up with a negative amount of "owned aircraft". --- game/settings/settings.py | 3 ++- game/squadrons/squadron.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/game/settings/settings.py b/game/settings/settings.py index 29030520..941e97e5 100644 --- a/game/settings/settings.py +++ b/game/settings/settings.py @@ -259,7 +259,8 @@ class Settings: default=False, detail=( "If set, squadrons will not be able to exceed a maximum number of aircraft " - "(configurable), and the campaign will begin with all squadrons at full strength." + "(configurable), and the campaign will begin with all squadrons at full strength " + "given enough room at the base." ), ) diff --git a/game/squadrons/squadron.py b/game/squadrons/squadron.py index 8210439c..ee074382 100644 --- a/game/squadrons/squadron.py +++ b/game/squadrons/squadron.py @@ -167,7 +167,7 @@ class Squadron: raise ValueError("Squadrons can only be created with active pilots.") self._recruit_pilots(self.settings.squadron_pilot_limit) if squadrons_start_full: - self.owned_aircraft = self.max_size + self.owned_aircraft = min(self.max_size, self.location.unclaimed_parking()) def end_turn(self) -> None: if self.destination is not None: