Remove code for old squadron rules.

This commit is contained in:
Dan Albert
2023-10-01 11:58:20 -07:00
parent 63584321c6
commit 69ec9adec7
9 changed files with 14 additions and 82 deletions

View File

@@ -163,12 +163,12 @@ class Coalition:
# is handled correctly.
self.transfers.perform_transfers()
def preinit_turn_0(self, squadrons_start_full: bool) -> None:
def preinit_turn_0(self) -> None:
"""Runs final Coalition initialization.
Final initialization occurs before Game.initialize_turn runs for turn 0.
"""
self.air_wing.populate_for_turn_0(squadrons_start_full)
self.air_wing.populate_for_turn_0()
def initialize_turn(self, is_turn_0: bool) -> None:
"""Processes coalition-specific turn initialization.
@@ -189,7 +189,7 @@ class Coalition:
with logged_duration("Transport planning"):
self.transfers.plan_transports(self.game.conditions.start_time)
if not is_turn_0 or not self.game.settings.enable_squadron_aircraft_limits:
if not is_turn_0:
self.plan_missions(self.game.conditions.start_time)
self.plan_procurement()

View File

@@ -292,7 +292,7 @@ class Game:
if self.turn > 1:
self.conditions = self.generate_conditions()
def begin_turn_0(self, squadrons_start_full: bool) -> None:
def begin_turn_0(self) -> None:
"""Initialization for the first turn of the game."""
from .sim import GameUpdateEvents
@@ -317,8 +317,8 @@ class Game:
# Rotate the whole TGO with the new heading
tgo.rotate(heading or tgo.heading)
self.blue.preinit_turn_0(squadrons_start_full)
self.red.preinit_turn_0(squadrons_start_full)
self.blue.preinit_turn_0()
self.red.preinit_turn_0()
# TODO: Check for overfull bases.
# We don't need to actually stream events for turn zero because we haven't given
# *any* state to the UI yet, so it will need to do a full draw once we do.

View File

@@ -254,15 +254,6 @@ class Settings:
"this many pilots each turn up to the limit."
),
)
# Feature flag for squadron limits.
enable_squadron_aircraft_limits: bool = boolean_option(
"Enable per-squadron aircraft limits",
CAMPAIGN_MANAGEMENT_PAGE,
PILOTS_AND_SQUADRONS_SECTION,
default=False,
remember_player_choice=True,
detail="If set, squadrons will be limited to a maximum number of aircraft.",
)
# HQ Automation
automate_runway_repair: bool = boolean_option(

View File

@@ -127,9 +127,9 @@ class AirWing:
def squadron_at_index(self, index: int) -> Squadron:
return list(self.iter_squadrons())[index]
def populate_for_turn_0(self, squadrons_start_full: bool) -> None:
def populate_for_turn_0(self) -> None:
for squadron in self.iter_squadrons():
squadron.populate_for_turn_0(squadrons_start_full)
squadron.populate_for_turn_0()
def end_turn(self) -> None:
for squadron in self.iter_squadrons():

View File

@@ -162,12 +162,11 @@ class Squadron:
self.current_roster.extend(new_pilots)
self.available_pilots.extend(new_pilots)
def populate_for_turn_0(self, squadrons_start_full: bool) -> None:
def populate_for_turn_0(self) -> None:
if any(p.status is not PilotStatus.Active for p in self.pilot_pool):
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 = self.max_size
def end_turn(self) -> None:
if self.destination is not None:
@@ -338,8 +337,6 @@ class Squadron:
return self.owned_aircraft + self.pending_deliveries
def has_aircraft_capacity_for(self, n: int) -> bool:
if not self.settings.enable_squadron_aircraft_limits:
return True
remaining = self.max_size - self.owned_aircraft - self.pending_deliveries
return remaining >= n