From 2b780e3d6961cfbbb1ea134443b0f80757c4a557 Mon Sep 17 00:00:00 2001 From: Raffson Date: Sun, 6 Oct 2024 18:12:44 +0200 Subject: [PATCH] Adjustable OPFOR headings when OPFOR ATO is selected --- qt_ui/windows/QLiberationWindow.py | 2 +- qt_ui/windows/groundobject/QGroundObjectMenu.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/qt_ui/windows/QLiberationWindow.py b/qt_ui/windows/QLiberationWindow.py index dc8ac0f2..93d0a623 100644 --- a/qt_ui/windows/QLiberationWindow.py +++ b/qt_ui/windows/QLiberationWindow.py @@ -603,7 +603,7 @@ class QLiberationWindow(QMainWindow): self.game_model.init_comms_registry() def open_tgo_info_dialog(self, tgo: TheaterGroundObject) -> None: - QGroundObjectMenu(self, tgo, tgo.control_point, self.game).show() + QGroundObjectMenu(self, tgo, tgo.control_point, self.game_model).show() def open_control_point_info_dialog(self, cp: ControlPoint) -> None: self._cp_dialog = QBaseMenu2(None, cp, self.game_model) diff --git a/qt_ui/windows/groundobject/QGroundObjectMenu.py b/qt_ui/windows/groundobject/QGroundObjectMenu.py index 839fb46e..cbad2c9c 100644 --- a/qt_ui/windows/groundobject/QGroundObjectMenu.py +++ b/qt_ui/windows/groundobject/QGroundObjectMenu.py @@ -15,7 +15,6 @@ from PySide6.QtWidgets import ( ) from dcs import Point -from game import Game from game.config import REWARDS from game.data.building_data import FORTIFICATION_BUILDINGS from game.server import EventStream @@ -25,6 +24,7 @@ from game.theater.theatergroundobject import ( BuildingGroundObject, ) from game.utils import Heading +from qt_ui.models import GameModel from qt_ui.uiconstants import EVENT_ICONS, ICONS from qt_ui.widgets.QBudgetBox import QBudgetBox from qt_ui.windows.GameUpdateSignal import GameUpdateSignal @@ -57,13 +57,14 @@ class QGroundObjectMenu(QDialog): parent, ground_object: TheaterGroundObject, cp: ControlPoint, - game: Game, + gm: GameModel, ): super().__init__(parent) self.setMinimumWidth(350) self.ground_object = ground_object self.cp = cp - self.game = game + self.game_model = gm + self.game = gm.game self.setWindowTitle( f"Location - {self.ground_object.obj_name} ({self.cp.name})" ) @@ -184,7 +185,6 @@ class QGroundObjectMenu(QDialog): self.headingLabel = QLabel("Heading:") self.orientationBoxLayout.addWidget(self.headingLabel) self.headingSelector = QSpinBox() - self.headingSelector.setEnabled(self.cp.is_friendly(to_player=True)) self.headingSelector.setRange(0, 359) self.headingSelector.setWrapping(True) self.headingSelector.setSingleStep(5) @@ -193,7 +193,8 @@ class QGroundObjectMenu(QDialog): lambda degrees: self.rotate_tgo(Heading(degrees)) ) self.orientationBoxLayout.addWidget(self.headingSelector) - if self.cp.captured: + can_adjust_heading = self.cp.is_friendly(to_player=self.game_model.is_ownfor) + if can_adjust_heading: self.head_to_conflict_button = QPushButton("Head to conflict") heading = ( self.game.theater.heading_to_conflict_from(self.ground_object.position)