diff --git a/changelog.md b/changelog.md index fb153681..33a77730 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ Saves from 2.5 are not compatible with 2.6. ## Features/Improvements * **[Campaign]** Ground units can now be transferred by road. See https://github.com/Khopa/dcs_liberation/wiki/Unit-Transfers for more information. +* **[Campaign]** Ground units can no longer be sold. To move units to a new location, transfer them. ## Fixes diff --git a/game/event/event.py b/game/event/event.py index 157b7461..116bc5d0 100644 --- a/game/event/event.py +++ b/game/event/event.py @@ -469,12 +469,15 @@ class UnitsDeliveryEvent: logging.info(f"Refunding {count} {unit_type.id} at {self.to_cp.name}") game.adjust_budget(price * count, player=self.to_cp.captured) - def available_next_turn(self, unit_type: Type[UnitType]) -> int: + def pending_orders(self, unit_type: Type[UnitType]) -> int: pending_units = self.units.get(unit_type) if pending_units is None: pending_units = 0 + return pending_units + + def available_next_turn(self, unit_type: Type[UnitType]) -> int: current_units = self.to_cp.base.total_units_of_type(unit_type) - return pending_units + current_units + return self.pending_orders(unit_type) + current_units def process(self, game: Game) -> None: bought_units: Dict[Type[UnitType], int] = {} diff --git a/qt_ui/windows/basemenu/ground_forces/QArmorRecruitmentMenu.py b/qt_ui/windows/basemenu/ground_forces/QArmorRecruitmentMenu.py index 46536204..fa7d0246 100644 --- a/qt_ui/windows/basemenu/ground_forces/QArmorRecruitmentMenu.py +++ b/qt_ui/windows/basemenu/ground_forces/QArmorRecruitmentMenu.py @@ -1,3 +1,5 @@ +from typing import Type + from PySide2.QtCore import Qt from PySide2.QtWidgets import ( QFrame, @@ -65,13 +67,13 @@ class QArmorRecruitmentMenu(QFrame, QRecruitBehaviour): main_layout.addWidget(scroll) self.setLayout(main_layout) - def sell(self, unit_type: UnitType): - if self.pending_deliveries.available_next_turn(unit_type) <= 0: + def sell(self, unit_type: Type[UnitType]) -> None: + if self.pending_deliveries.pending_orders(unit_type) <= 0: QMessageBox.critical( self, "Could not sell ground unit", - f"Attempted to sell one {unit_type.id} at {self.cp.name} " - "but none are available.", + f"Attempted to cancel order of one {unit_type.id} at {self.cp.name} " + "but no orders are pending.", QMessageBox.Ok, ) return