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

@@ -230,10 +230,7 @@ def parse_args() -> argparse.Namespace:
new_game.add_argument(
"--use-new-squadron-rules",
action="store_true",
help=(
"Limit the number of aircraft per squadron and begin the campaign with "
"them at full strength."
),
help="Deprecated. Does nothing.",
)
new_game.add_argument(
@@ -285,7 +282,6 @@ class CreateGameParams:
start_date: datetime
restrict_weapons_by_date: bool
advanced_iads: bool
use_new_squadron_rules: bool
show_air_wing_config: bool
@staticmethod
@@ -303,7 +299,6 @@ class CreateGameParams:
args.date,
args.restrict_weapons_by_date,
args.advanced_iads,
args.use_new_squadron_rules,
args.show_air_wing_config,
)
@@ -327,7 +322,6 @@ def create_game(params: CreateGameParams) -> Game:
enable_frontline_cheats=params.cheats,
enable_base_capture_cheat=params.cheats,
restrict_weapons_by_date=params.restrict_weapons_by_date,
enable_squadron_aircraft_limits=params.use_new_squadron_rules,
),
GeneratorSettings(
start_date=params.start_date,
@@ -357,7 +351,7 @@ def create_game(params: CreateGameParams) -> Game:
if params.show_air_wing_config:
if AirWingConfigurationDialog(game, None).exec() == QDialog.DialogCode.Rejected:
sys.exit("Aborted air wing configuration")
game.begin_turn_0(squadrons_start_full=params.use_new_squadron_rules)
game.begin_turn_0()
return game

View File

@@ -839,9 +839,6 @@ class AirWingConfigurationDialog(QDialog):
tab.revert()
def can_continue(self) -> bool:
if not self.game.settings.enable_squadron_aircraft_limits:
return True
overfull = list(self.parking_tracker.iter_overfull())
if not overfull:
return True

View File

@@ -163,7 +163,6 @@ class NewGameWizard(QtWidgets.QWizard):
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"))
settings = Settings(
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"),
supercarrier=self.field("supercarrier"),
enable_squadron_aircraft_limits=use_new_squadron_rules,
)
settings.save_player_settings()
generator_settings = GeneratorSettings(
@@ -235,7 +233,7 @@ class NewGameWizard(QtWidgets.QWizard):
logging.info("Aborted air wing configuration")
return
game.begin_turn_0(squadrons_start_full=use_new_squadron_rules)
game.begin_turn_0()
GameUpdateSignal.get_instance().game_generated.emit(game)
super(NewGameWizard, self).accept()
@@ -587,35 +585,6 @@ class BudgetInputs(QtWidgets.QGridLayout):
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):
def __init__(
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)
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")
layout.addWidget(assist_group)
assist_layout = QtWidgets.QGridLayout()
@@ -706,7 +659,6 @@ class DifficultyAndAutomationOptions(QtWidgets.QWizardPage):
self.enemy_income.spinner.setValue(
int(campaign.recommended_enemy_income_multiplier * 10)
)
self.new_squadron_rules_warning.set_campaign(campaign)
class PluginOptionCheckbox(QCheckBox):