remove completely destroyed units from the convoy

(cherry picked from commit 8ba27cdaea)
This commit is contained in:
RndName
2021-07-05 22:36:01 +02:00
committed by Dan Albert
parent 4b526e2b90
commit 4b1d629e9b

View File

@@ -99,7 +99,10 @@ class TransferOrder:
def kill_unit(self, unit_type: GroundUnitType) -> None:
if unit_type not in self.units or not self.units[unit_type]:
raise KeyError(f"{self} has no {unit_type} remaining")
self.units[unit_type] -= 1
if self.units[unit_type] == 1:
del self.units[unit_type]
else:
self.units[unit_type] -= 1
@property
def size(self) -> int: