Fix selling of units not visible

allow pending_deliveries to become negative again but still delete the delivery when the amount of a specific unit_type comes to exactly 0 to prevent emtpy group sizes
This commit is contained in:
RndName 2021-08-12 14:58:17 +02:00
parent bc5ffdec8e
commit ee8e8d4a9a
No known key found for this signature in database
GPG Key ID: 5EF516FD9537F7C0
2 changed files with 3 additions and 3 deletions

View File

@ -22,6 +22,7 @@ Saves from 4.x are not compatible with 5.0.
## Fixes
* **[Campaign]** Naval control points will no longer claim ground objectives during campaign generation and prevent them from spawning.
* **[UI]** Selling of Units is now visible again in the UI dialog and shows the correct amount of sold units
# 4.1.1

View File

@ -40,9 +40,8 @@ class PendingUnitDeliveries:
def sell(self, units: dict[UnitType[Any], int]) -> None:
for k, v in units.items():
if self.units[k] > v:
self.units[k] -= v
else:
self.units[k] -= v
if self.units[k] == 0:
del self.units[k]
def refund_all(self, coalition: Coalition) -> None: