<URL: http://bugs.freeciv.org/Ticket/Display.html?id=15097 >

My version of the allow-aircraft-to-goto patch. It allows movement
anywhere as long as we have movement points to return, and allow
attacks, even suicidal ones. Of course, it is still not perfect, since
for example fighters cannot goto to "see" the enemy and then attack it,
but I think it is a highly useful band-aid before we come up with
something better.

  - Per 
Index: common/aicore/pf_tools.c
===================================================================
--- common/aicore/pf_tools.c	(revision 12760)
+++ common/aicore/pf_tools.c	(working copy)
@@ -547,9 +547,9 @@
 				 struct pf_parameter *param)
 {
   struct base_type *pbase;
+  int moves = SINGLE_MOVE * real_map_distance(param->start_tile, ptile);
+  int fuel = param->fuel_left_initially - 1;
 
-  /* FIXME: bombers with fuel remaining should not worry about danger. */
-
   if (is_allied_city_tile(ptile, param->owner)) {
     return FALSE;
   }
@@ -562,6 +562,17 @@
     return FALSE;
   }
 
+  if (param->moves_left_initially + param->move_rate * fuel >= moves * 2) {
+    if (param->fuel_left_initially > 1
+        || ((param->fuel_left_initially > 2 
+             || !BV_ISSET(param->unit_flags, F_ONEATTACK))
+            && (is_enemy_unit_tile(ptile, param->owner)
+                || (ptile->city && is_enemy_city_tile(ptile, param->owner))))) {
+      /* allow movement if fuelled, and attacks, even suicidal ones */
+      return FALSE; 
+    }
+  }
+
   /* Carriers are ignored since they are likely to move. */
   return TRUE;
 }
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to