From 2e7bd06b70c59ea0d1c54bce2114e8d313bfe905 Mon Sep 17 00:00:00 2001
From: notoraptor <stevenbocco@gmail.com>
Date: Thu, 25 Oct 2018 11:21:10 -0400
Subject: DATC 6.K.1 - Testing Civil Disorder (W1901A) with 1 order and 2 to
 remove

---
 diplomacy/engine/game.py | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'diplomacy/engine/game.py')

diff --git a/diplomacy/engine/game.py b/diplomacy/engine/game.py
index 44b2509..a71d486 100644
--- a/diplomacy/engine/game.py
+++ b/diplomacy/engine/game.py
@@ -4030,6 +4030,7 @@ class Game(Jsonable):
         self.command = {}
         self.ordered_units = {}
         conflicts = {}
+        disbanded_units = set()
 
         # Adjustments
         if self.phase_type == 'A':
@@ -4085,6 +4086,7 @@ class Game(Jsonable):
                         unit = ' '.join(word[:2])
                         if word[-1] == 'D':
                             diff -= 1
+                            disbanded_units.add(unit)
                         else:
                             self.result.setdefault(unit, []).append('void')
                             power.adjust.remove(order)
@@ -4101,6 +4103,8 @@ class Game(Jsonable):
 
                     # Calculating distance to home
                     for unit in power.units:
+                        if unit in disbanded_units:
+                            continue
                         distance = self._get_distance_to_home(unit[0], unit[2:], power.homes)
                         if unit[0] == 'F':
                             fleets[unit] = -1 * distance
-- 
cgit v1.2.3