diff --git a/changelog.md b/changelog.md index dcb02a6f..c05ab8a1 100644 --- a/changelog.md +++ b/changelog.md @@ -26,6 +26,7 @@ Saves from 2.5 are not compatible with 3.0. * **[UI]** Added new web based map UI. This is mostly functional but many of the old display options are a WIP. Revert to the old map with --old-map. * **[UI]** Campaigns generated for an older or newer version of the game will now be marked as incompatible. They can still be played, but bugs may be present. * **[UI]** DCS loadouts are now selectable in the loadout setup menu. +* **[UI]** Base menu now shows information about ground unit deployment limits. * **[Modding]** Campaigns now choose locations for factories to spawn. * **[Modding]** Campaigns now use map structures as strike targets. * **[Modding]** Campaigns may now set *any* objective type to be a required spawn rather than random chance. diff --git a/game/theater/controlpoint.py b/game/theater/controlpoint.py index 3fe0c90e..c3b0c235 100644 --- a/game/theater/controlpoint.py +++ b/game/theater/controlpoint.py @@ -1,5 +1,4 @@ from __future__ import annotations -from game.data.groundunitclass import GroundUnitClass import heapq import itertools @@ -802,9 +801,9 @@ class ControlPoint(MissionTarget, ABC): @property def active_ammo_depots_count(self) -> int: """Return the number of available ammo depots""" - return sum( + return len( [ - 1 + obj for obj in self.connected_objectives if obj.category == "ammo" and not obj.is_dead ] @@ -813,7 +812,7 @@ class ControlPoint(MissionTarget, ABC): @property def total_ammo_depots_count(self) -> int: """Return the number of ammo depots, including dead ones""" - return sum([1 for obj in self.connected_objectives if obj.category == "ammo"]) + return len([obj for obj in self.connected_objectives if obj.category == "ammo"]) @property def strike_targets(self) -> List[Union[MissionTarget, Unit]]: diff --git a/qt_ui/windows/basemenu/QBaseMenu2.py b/qt_ui/windows/basemenu/QBaseMenu2.py index 47d63b3b..889af5cf 100644 --- a/qt_ui/windows/basemenu/QBaseMenu2.py +++ b/qt_ui/windows/basemenu/QBaseMenu2.py @@ -11,7 +11,12 @@ from PySide2.QtWidgets import ( ) from game import Game, db -from game.theater import ControlPoint, ControlPointType +from game.theater import ( + ControlPoint, + ControlPointType, + FREE_FRONTLINE_UNIT_SUPPLY, + AMMO_DEPOT_FRONTLINE_UNIT_CONTRIBUTION, +) from gen.flights.flight import FlightType from qt_ui.dialogs import Dialog from qt_ui.models import GameModel @@ -62,6 +67,7 @@ class QBaseMenu2(QDialog): title.setAlignment(Qt.AlignLeft | Qt.AlignTop) title.setProperty("style", "base-title") self.intel_summary = QLabel() + self.intel_summary.setToolTip(self.generate_intel_tooltip()) self.update_intel_summary() top_layout.addWidget(title) top_layout.addWidget(self.intel_summary) @@ -195,11 +201,20 @@ class QBaseMenu2(QDialog): def update_intel_summary(self) -> None: aircraft = self.cp.base.total_aircraft parking = self.cp.total_aircraft_parking + ground_unit_limit = self.cp.frontline_unit_count_limit + deployable_unit_info = "" + unit_overage = max( + self.cp.base.total_armor - self.cp.frontline_unit_count_limit, 0 + ) + if self.cp.has_active_frontline: + deployable_unit_info = ( + f" (Up to {ground_unit_limit} deployable, {unit_overage} reserve)" + ) self.intel_summary.setText( "\n".join( [ f"{aircraft}/{parking} aircraft", - f"{self.cp.base.total_armor} ground units", + f"{self.cp.base.total_armor} ground units" + deployable_unit_info, str(self.cp.runway_status), f"{self.cp.active_ammo_depots_count}/{self.cp.total_ammo_depots_count} ammo depots", f"{'Factory can produce units' if self.cp.has_factory else 'Does not have a factory'}", @@ -207,6 +222,24 @@ class QBaseMenu2(QDialog): ) ) + def generate_intel_tooltip(self) -> str: + tooltip = ( + f"Deployable unit limit ({self.cp.frontline_unit_count_limit}) = {FREE_FRONTLINE_UNIT_SUPPLY} (base) + " + f" {AMMO_DEPOT_FRONTLINE_UNIT_CONTRIBUTION} (per connected ammo depot) * {self.cp.total_ammo_depots_count} " + f"(depots)" + ) + + if self.cp.has_active_frontline: + unit_overage = max( + self.cp.base.total_armor - self.cp.frontline_unit_count_limit, 0 + ) + tooltip += ( + f"\n{unit_overage} units will be held in reserve and will not be deployed to " + f"connected frontlines for this turn" + ) + + return tooltip + def closeEvent(self, close_event: QCloseEvent): GameUpdateSignal.get_instance().updateGame(self.game_model.game)