Show pending ground unit count in the base menu.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1161
This commit is contained in:
Dan Albert 2021-06-05 13:24:12 -07:00
parent e3bc2688ba
commit 6094179a40
2 changed files with 18 additions and 6 deletions

View File

@ -151,11 +151,19 @@ class GroundUnitAllocations:
@cached_property
def total(self) -> int:
return (
sum(self.present.values())
+ sum(self.ordered.values())
+ sum(self.transferring.values())
)
return self.total_present + self.total_ordered + self.total_transferring
@cached_property
def total_present(self) -> int:
return sum(self.present.values())
@cached_property
def total_ordered(self) -> int:
return sum(self.ordered.values())
@cached_property
def total_transferring(self) -> int:
return sum(self.transferring.values())
@dataclass

View File

@ -203,18 +203,22 @@ class QBaseMenu2(QDialog):
parking = self.cp.total_aircraft_parking
ground_unit_limit = self.cp.frontline_unit_count_limit
deployable_unit_info = ""
allocated = self.cp.allocated_ground_units(self.game_model.game.transfers)
unit_overage = max(
self.cp.base.total_armor - self.cp.frontline_unit_count_limit, 0
allocated.total_present - 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" + deployable_unit_info,
f"{allocated.total_transferring} more ground units en route, {allocated.total_ordered} ordered",
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'}",