remove completely destroyed units from the convoy

(cherry picked from commit 8ba27cdaeae84914aced36851d78f070b1ee1f63)
This commit is contained in:
RndName 2021-07-05 22:36:01 +02:00 committed by Dan Albert
parent 8fae7decca
commit 251c84019f

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: