remove completely destroyed units from the convoy

This commit is contained in:
RndName 2021-07-05 22:36:01 +02:00 committed by Dan Albert
parent 1c2411a0fc
commit 8ba27cdaea

View File

@ -130,7 +130,10 @@ class TransferOrder:
def kill_unit(self, unit_type: GroundUnitType) -> None: def kill_unit(self, unit_type: GroundUnitType) -> None:
if unit_type not in self.units or not self.units[unit_type]: if unit_type not in self.units or not self.units[unit_type]:
raise KeyError(f"{self} has no {unit_type} remaining") 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 @property
def size(self) -> int: def size(self) -> int: