Commits

Arne Babenhauserheide  committed b69057d

trying further to track down missing target fields.

  • Participants
  • Parent commits bdbd1e2

Comments (0)

Files changed (1)

File hexbattle_units.py

         FIXME: Some fields are left out for some reason. 
         """
         targets = set()
+        minus2 = self.hex_x - 2, self.hex_y +1
         def add(position):
             if not position in self.hexmap:
                 targets.add(position)
                         targets.add(pos)
                     if hexunit is None: 
                         path = self.path_to(pos)
-                        if not path: # target not reachable in any way.
-                            continue
-                        for pos in path[:self.max_move]:
-                            add(pos)
-                        # if we can reach the target, add it
-                        pos_is_reachable = len(path) < self.max_move
-                        if pos_is_reachable:
-                            add(pos)
-        
+                        if path: # target reachable.
+                            for pos in path[:self.max_move]:
+                                add(pos)
+                            # if we can reach the target, add it
+                            pos_is_reachable = len(path) < self.max_move
+                            if pos_is_reachable:
+                                add(pos)
+        if not minus2 in targets:
+            #print self.path_to(minus2), self.max_move, self.distance(self.hex_x, self.hex_y, minus2[0], minus2[1])
+            #print self.hexmap.get(minus2, None), minus2 in self.hexmap
+            # FIXME: This field is often missing. I really do not understand why.
+            pass
         return list(targets)
 
     def twopos2fourhex(self, pos1, pos2):