Anonymous avatar Anonymous committed b69057d

trying further to track down missing target fields.

Comments (0)

Files changed (1)

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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.