mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Remove code for old squadron rules.
This commit is contained in:
parent
63584321c6
commit
69ec9adec7
@ -6,6 +6,7 @@ Saves from 8.x are not compatible with 9.0.0.
|
|||||||
|
|
||||||
* **[Engine]** Support for DCS Open Beta 2.8.8.43489.
|
* **[Engine]** Support for DCS Open Beta 2.8.8.43489.
|
||||||
* **[Campaign]** Added ferry only control points, which offer campaign designers a way to add squadrons that can be brought in after additional airfields are captured.
|
* **[Campaign]** Added ferry only control points, which offer campaign designers a way to add squadrons that can be brought in after additional airfields are captured.
|
||||||
|
* **[Campaign]** The new squadron rules (size limits, beginning the campaign at full strength) are now the default and required. The old style of unlimited squadron sizes and starting with zero aircraft has been removed.
|
||||||
* **[Data]** Added support for the ARA Veinticinco de Mayo.
|
* **[Data]** Added support for the ARA Veinticinco de Mayo.
|
||||||
* **[Data]** Changed display name of the AI-only F-15E Strike Eagle for clarity.
|
* **[Data]** Changed display name of the AI-only F-15E Strike Eagle for clarity.
|
||||||
* **[Flight Planning]** Improved IP selection for targets that are near the center of a threat zone.
|
* **[Flight Planning]** Improved IP selection for targets that are near the center of a threat zone.
|
||||||
|
|||||||
@ -163,12 +163,12 @@ class Coalition:
|
|||||||
# is handled correctly.
|
# is handled correctly.
|
||||||
self.transfers.perform_transfers()
|
self.transfers.perform_transfers()
|
||||||
|
|
||||||
def preinit_turn_0(self, squadrons_start_full: bool) -> None:
|
def preinit_turn_0(self) -> None:
|
||||||
"""Runs final Coalition initialization.
|
"""Runs final Coalition initialization.
|
||||||
|
|
||||||
Final initialization occurs before Game.initialize_turn runs for turn 0.
|
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:
|
def initialize_turn(self, is_turn_0: bool) -> None:
|
||||||
"""Processes coalition-specific turn initialization.
|
"""Processes coalition-specific turn initialization.
|
||||||
@ -189,7 +189,7 @@ class Coalition:
|
|||||||
with logged_duration("Transport planning"):
|
with logged_duration("Transport planning"):
|
||||||
self.transfers.plan_transports(self.game.conditions.start_time)
|
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_missions(self.game.conditions.start_time)
|
||||||
self.plan_procurement()
|
self.plan_procurement()
|
||||||
|
|
||||||
|
|||||||
@ -292,7 +292,7 @@ class Game:
|
|||||||
if self.turn > 1:
|
if self.turn > 1:
|
||||||
self.conditions = self.generate_conditions()
|
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."""
|
"""Initialization for the first turn of the game."""
|
||||||
from .sim import GameUpdateEvents
|
from .sim import GameUpdateEvents
|
||||||
|
|
||||||
@ -317,8 +317,8 @@ class Game:
|
|||||||
# Rotate the whole TGO with the new heading
|
# Rotate the whole TGO with the new heading
|
||||||
tgo.rotate(heading or tgo.heading)
|
tgo.rotate(heading or tgo.heading)
|
||||||
|
|
||||||
self.blue.preinit_turn_0(squadrons_start_full)
|
self.blue.preinit_turn_0()
|
||||||
self.red.preinit_turn_0(squadrons_start_full)
|
self.red.preinit_turn_0()
|
||||||
# TODO: Check for overfull bases.
|
# TODO: Check for overfull bases.
|
||||||
# We don't need to actually stream events for turn zero because we haven't given
|
# 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.
|
# *any* state to the UI yet, so it will need to do a full draw once we do.
|
||||||
|
|||||||
@ -254,15 +254,6 @@ class Settings:
|
|||||||
"this many pilots each turn up to the limit."
|
"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
|
# HQ Automation
|
||||||
automate_runway_repair: bool = boolean_option(
|
automate_runway_repair: bool = boolean_option(
|
||||||
|
|||||||
@ -127,9 +127,9 @@ class AirWing:
|
|||||||
def squadron_at_index(self, index: int) -> Squadron:
|
def squadron_at_index(self, index: int) -> Squadron:
|
||||||
return list(self.iter_squadrons())[index]
|
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():
|
for squadron in self.iter_squadrons():
|
||||||
squadron.populate_for_turn_0(squadrons_start_full)
|
squadron.populate_for_turn_0()
|
||||||
|
|
||||||
def end_turn(self) -> None:
|
def end_turn(self) -> None:
|
||||||
for squadron in self.iter_squadrons():
|
for squadron in self.iter_squadrons():
|
||||||
|
|||||||
@ -162,12 +162,11 @@ class Squadron:
|
|||||||
self.current_roster.extend(new_pilots)
|
self.current_roster.extend(new_pilots)
|
||||||
self.available_pilots.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):
|
if any(p.status is not PilotStatus.Active for p in self.pilot_pool):
|
||||||
raise ValueError("Squadrons can only be created with active pilots.")
|
raise ValueError("Squadrons can only be created with active pilots.")
|
||||||
self._recruit_pilots(self.settings.squadron_pilot_limit)
|
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:
|
def end_turn(self) -> None:
|
||||||
if self.destination is not None:
|
if self.destination is not None:
|
||||||
@ -338,8 +337,6 @@ class Squadron:
|
|||||||
return self.owned_aircraft + self.pending_deliveries
|
return self.owned_aircraft + self.pending_deliveries
|
||||||
|
|
||||||
def has_aircraft_capacity_for(self, n: int) -> bool:
|
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
|
remaining = self.max_size - self.owned_aircraft - self.pending_deliveries
|
||||||
return remaining >= n
|
return remaining >= n
|
||||||
|
|
||||||
|
|||||||
@ -230,10 +230,7 @@ def parse_args() -> argparse.Namespace:
|
|||||||
new_game.add_argument(
|
new_game.add_argument(
|
||||||
"--use-new-squadron-rules",
|
"--use-new-squadron-rules",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help=(
|
help="Deprecated. Does nothing.",
|
||||||
"Limit the number of aircraft per squadron and begin the campaign with "
|
|
||||||
"them at full strength."
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
new_game.add_argument(
|
new_game.add_argument(
|
||||||
@ -285,7 +282,6 @@ class CreateGameParams:
|
|||||||
start_date: datetime
|
start_date: datetime
|
||||||
restrict_weapons_by_date: bool
|
restrict_weapons_by_date: bool
|
||||||
advanced_iads: bool
|
advanced_iads: bool
|
||||||
use_new_squadron_rules: bool
|
|
||||||
show_air_wing_config: bool
|
show_air_wing_config: bool
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -303,7 +299,6 @@ class CreateGameParams:
|
|||||||
args.date,
|
args.date,
|
||||||
args.restrict_weapons_by_date,
|
args.restrict_weapons_by_date,
|
||||||
args.advanced_iads,
|
args.advanced_iads,
|
||||||
args.use_new_squadron_rules,
|
|
||||||
args.show_air_wing_config,
|
args.show_air_wing_config,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -327,7 +322,6 @@ def create_game(params: CreateGameParams) -> Game:
|
|||||||
enable_frontline_cheats=params.cheats,
|
enable_frontline_cheats=params.cheats,
|
||||||
enable_base_capture_cheat=params.cheats,
|
enable_base_capture_cheat=params.cheats,
|
||||||
restrict_weapons_by_date=params.restrict_weapons_by_date,
|
restrict_weapons_by_date=params.restrict_weapons_by_date,
|
||||||
enable_squadron_aircraft_limits=params.use_new_squadron_rules,
|
|
||||||
),
|
),
|
||||||
GeneratorSettings(
|
GeneratorSettings(
|
||||||
start_date=params.start_date,
|
start_date=params.start_date,
|
||||||
@ -357,7 +351,7 @@ def create_game(params: CreateGameParams) -> Game:
|
|||||||
if params.show_air_wing_config:
|
if params.show_air_wing_config:
|
||||||
if AirWingConfigurationDialog(game, None).exec() == QDialog.DialogCode.Rejected:
|
if AirWingConfigurationDialog(game, None).exec() == QDialog.DialogCode.Rejected:
|
||||||
sys.exit("Aborted air wing configuration")
|
sys.exit("Aborted air wing configuration")
|
||||||
game.begin_turn_0(squadrons_start_full=params.use_new_squadron_rules)
|
game.begin_turn_0()
|
||||||
return game
|
return game
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -839,9 +839,6 @@ class AirWingConfigurationDialog(QDialog):
|
|||||||
tab.revert()
|
tab.revert()
|
||||||
|
|
||||||
def can_continue(self) -> bool:
|
def can_continue(self) -> bool:
|
||||||
if not self.game.settings.enable_squadron_aircraft_limits:
|
|
||||||
return True
|
|
||||||
|
|
||||||
overfull = list(self.parking_tracker.iter_overfull())
|
overfull = list(self.parking_tracker.iter_overfull())
|
||||||
if not overfull:
|
if not overfull:
|
||||||
return True
|
return True
|
||||||
|
|||||||
@ -163,7 +163,6 @@ class NewGameWizard(QtWidgets.QWizard):
|
|||||||
|
|
||||||
self.lua_plugin_manager.save_player_settings()
|
self.lua_plugin_manager.save_player_settings()
|
||||||
|
|
||||||
use_new_squadron_rules = self.field("use_new_squadron_rules")
|
|
||||||
logging.info("New campaign start date: %s", start_date.strftime("%m/%d/%Y"))
|
logging.info("New campaign start date: %s", start_date.strftime("%m/%d/%Y"))
|
||||||
settings = Settings(
|
settings = Settings(
|
||||||
player_income_multiplier=self.field("player_income_multiplier") / 10,
|
player_income_multiplier=self.field("player_income_multiplier") / 10,
|
||||||
@ -177,7 +176,6 @@ class NewGameWizard(QtWidgets.QWizard):
|
|||||||
),
|
),
|
||||||
automate_aircraft_reinforcements=self.field("automate_aircraft_purchases"),
|
automate_aircraft_reinforcements=self.field("automate_aircraft_purchases"),
|
||||||
supercarrier=self.field("supercarrier"),
|
supercarrier=self.field("supercarrier"),
|
||||||
enable_squadron_aircraft_limits=use_new_squadron_rules,
|
|
||||||
)
|
)
|
||||||
settings.save_player_settings()
|
settings.save_player_settings()
|
||||||
generator_settings = GeneratorSettings(
|
generator_settings = GeneratorSettings(
|
||||||
@ -235,7 +233,7 @@ class NewGameWizard(QtWidgets.QWizard):
|
|||||||
logging.info("Aborted air wing configuration")
|
logging.info("Aborted air wing configuration")
|
||||||
return
|
return
|
||||||
|
|
||||||
game.begin_turn_0(squadrons_start_full=use_new_squadron_rules)
|
game.begin_turn_0()
|
||||||
GameUpdateSignal.get_instance().game_generated.emit(game)
|
GameUpdateSignal.get_instance().game_generated.emit(game)
|
||||||
|
|
||||||
super(NewGameWizard, self).accept()
|
super(NewGameWizard, self).accept()
|
||||||
@ -587,35 +585,6 @@ class BudgetInputs(QtWidgets.QGridLayout):
|
|||||||
self.addWidget(self.starting_money, 1, 1)
|
self.addWidget(self.starting_money, 1, 1)
|
||||||
|
|
||||||
|
|
||||||
class NewSquadronRulesWarning(QLabel):
|
|
||||||
def __init__(
|
|
||||||
self, campaign: Campaign | None, parent: QWidget | None = None
|
|
||||||
) -> None:
|
|
||||||
super().__init__(parent)
|
|
||||||
self.set_campaign(campaign)
|
|
||||||
|
|
||||||
def set_campaign(self, campaign: Campaign | None) -> None:
|
|
||||||
if campaign is None:
|
|
||||||
self.setText("No campaign selected")
|
|
||||||
return
|
|
||||||
if campaign.version >= (10, 9):
|
|
||||||
text = f"{campaign.name} is compatible with the new squadron rules."
|
|
||||||
elif campaign.version >= (10, 7):
|
|
||||||
text = (
|
|
||||||
f"{campaign.name} has been updated since the new squadron rules were "
|
|
||||||
"introduced, but support for those rules was still optional. You may "
|
|
||||||
"need to remove, resize, or relocate squadrons before beginning the "
|
|
||||||
"game."
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
text = (
|
|
||||||
f"{campaign.name} has not been updated since the new squadron rules. "
|
|
||||||
"Were introduced. You may need to remove, resize, or relocate "
|
|
||||||
"squadrons before beginning the game."
|
|
||||||
)
|
|
||||||
self.setText(wrap_label_text(text))
|
|
||||||
|
|
||||||
|
|
||||||
class DifficultyAndAutomationOptions(QtWidgets.QWizardPage):
|
class DifficultyAndAutomationOptions(QtWidgets.QWizardPage):
|
||||||
def __init__(
|
def __init__(
|
||||||
self, default_settings: Settings, current_campaign: Campaign | None, parent=None
|
self, default_settings: Settings, current_campaign: Campaign | None, parent=None
|
||||||
@ -656,22 +625,6 @@ class DifficultyAndAutomationOptions(QtWidgets.QWizardPage):
|
|||||||
self.registerField("enemy_starting_money", self.enemy_budget.starting_money)
|
self.registerField("enemy_starting_money", self.enemy_budget.starting_money)
|
||||||
economy_layout.addLayout(self.enemy_budget)
|
economy_layout.addLayout(self.enemy_budget)
|
||||||
|
|
||||||
new_squadron_rules = QtWidgets.QCheckBox("Enable new squadron rules")
|
|
||||||
new_squadron_rules.setChecked(default_settings.enable_squadron_aircraft_limits)
|
|
||||||
self.registerField("use_new_squadron_rules", new_squadron_rules)
|
|
||||||
economy_layout.addWidget(new_squadron_rules)
|
|
||||||
self.new_squadron_rules_warning = NewSquadronRulesWarning(current_campaign)
|
|
||||||
economy_layout.addWidget(self.new_squadron_rules_warning)
|
|
||||||
economy_layout.addWidget(
|
|
||||||
QLabel(
|
|
||||||
wrap_label_text(
|
|
||||||
"With new squadron rules enabled, squadrons will not be able to "
|
|
||||||
"exceed a maximum number of aircraft (configurable), and the "
|
|
||||||
"campaign will begin with all squadrons at full strength."
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
assist_group = QtWidgets.QGroupBox("Player assists")
|
assist_group = QtWidgets.QGroupBox("Player assists")
|
||||||
layout.addWidget(assist_group)
|
layout.addWidget(assist_group)
|
||||||
assist_layout = QtWidgets.QGridLayout()
|
assist_layout = QtWidgets.QGridLayout()
|
||||||
@ -706,7 +659,6 @@ class DifficultyAndAutomationOptions(QtWidgets.QWizardPage):
|
|||||||
self.enemy_income.spinner.setValue(
|
self.enemy_income.spinner.setValue(
|
||||||
int(campaign.recommended_enemy_income_multiplier * 10)
|
int(campaign.recommended_enemy_income_multiplier * 10)
|
||||||
)
|
)
|
||||||
self.new_squadron_rules_warning.set_campaign(campaign)
|
|
||||||
|
|
||||||
|
|
||||||
class PluginOptionCheckbox(QCheckBox):
|
class PluginOptionCheckbox(QCheckBox):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user