From d051774464392195508c550c66b529e7328d2733 Mon Sep 17 00:00:00 2001 From: Raffson Date: Mon, 1 Apr 2024 22:07:35 +0200 Subject: [PATCH] Allow naval adjustments on turn 0 --- changelog.md | 1 + qt_ui/windows/groundobject/QGroundObjectBuyMenu.py | 4 ++++ qt_ui/windows/groundobject/QGroundObjectMenu.py | 6 ++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index ebca595d..fe721d3f 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,7 @@ * **[Campaigns/Factions]** Support for inline recommended faction in campaign's yaml file * **[Squadrons]** Ability to define a livery-set for each squadron from which Retribution will randomly choose during mission generation * **[Modding]** Updated support for F/A-18E/F/G mod version 2.2.5 +* **[Campaign Setup]** Allow adjustments to naval TGOs (except carriers) on turn 0 ## Fixes * **[UI/UX]** A-10A flights can be edited again. diff --git a/qt_ui/windows/groundobject/QGroundObjectBuyMenu.py b/qt_ui/windows/groundobject/QGroundObjectBuyMenu.py index 1f946362..91a51298 100644 --- a/qt_ui/windows/groundobject/QGroundObjectBuyMenu.py +++ b/qt_ui/windows/groundobject/QGroundObjectBuyMenu.py @@ -32,6 +32,7 @@ from game.theater.theatergroundobject import ( EwrGroundObject, SamGroundObject, VehicleGroupGroundObject, + ShipGroundObject, ) from qt_ui.uiconstants import EVENT_ICONS @@ -278,6 +279,9 @@ class QGroundObjectBuyMenu(QDialog): elif isinstance(ground_object, EwrGroundObject): role = GroupRole.AIR_DEFENSE tasks.append(GroupTask.EARLY_WARNING_RADAR) + elif isinstance(ground_object, ShipGroundObject): + role = GroupRole.NAVAL + tasks.append(GroupTask.NAVY) else: raise NotImplementedError(f"Unhandled TGO type {ground_object.__class__}") diff --git a/qt_ui/windows/groundobject/QGroundObjectMenu.py b/qt_ui/windows/groundobject/QGroundObjectMenu.py index 0b15182d..e8faeec5 100644 --- a/qt_ui/windows/groundobject/QGroundObjectMenu.py +++ b/qt_ui/windows/groundobject/QGroundObjectMenu.py @@ -104,12 +104,14 @@ class QGroundObjectMenu(QDialog): self.buy_replace.clicked.connect(self.buy_group) self.buy_replace.setProperty("style", "btn-success") - if self.ground_object.purchasable: + if self.ground_object.purchasable or self.game.turn == 0: if self.total_value > 0: self.actionLayout.addWidget(self.sell_all_button) self.actionLayout.addWidget(self.buy_replace) - if self.show_buy_sell_actions and self.ground_object.purchasable: + if self.show_buy_sell_actions and ( + self.ground_object.purchasable or self.game.turn == 0 + ): self.mainLayout.addLayout(self.actionLayout) self.setLayout(self.mainLayout)