fix generation of empty transfer during cp capture

when a cp capture happens and the next cp has pending unit deliveries then they will be redeployed to the newly captured cp. The redeploy was drecreasing the num of pending unit deliveries for the old cp but was not removing them completly from the dict when all were removed
This commit is contained in:
RndName
2021-07-25 14:59:56 +02:00
parent 80bf3c97b2
commit 67fa4a8910
3 changed files with 5 additions and 3 deletions

View File

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