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

(cherry picked from commit 67fa4a8910)
This commit is contained in:
RndName
2021-07-25 14:59:56 +02:00
committed by Dan Albert
parent 49b1764d89
commit b1b8ad3f1a
3 changed files with 5 additions and 3 deletions

View File

@@ -39,7 +39,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, game: Game) -> None:
self.refund(game, self.units)