[Freeciv-Dev] (PR#15097) air units only autoroute to my cities (or allies)

2007-03-07 Thread Per I. Mathisen

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


Re: [Freeciv-Dev] (PR#15097) air units only autoroute to my cities (or allies)

2007-03-17 Thread Daniel Markstedt

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

On 3/8/07, Per I. Mathisen <[EMAIL PROTECTED]> wrote:
>
> 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
>

Doesn't apply cleanly to S2_1 (the branch that most desperately needs
this band-aid.)

 ~Daniel



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev