| [Freeciv-Dev] Re: (PR#6123) AutoReply: Loop in ai_manage_airunit[Top] [All Lists][Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
 
 On Tue, Sep 09, 2003 at 02:06:43PM -0700, ue80@xxxxxxxxxxxxxxxxxxxxx wrote:
> On Tue, Sep 09, 2003 at 01:21:32PM -0700, incoming wrote:
> > This happens when defending a transporter (or was it a dipl) with a
> > bomber.
> 
> And it is adjacent to a city where the AI has a bomber.
Ok, tried to fix that bug, don't know if the fix is at the right place.
But the check if we can attack is missing somewhere.
Thomas
-- 
Thomas Strub  ***  eMail ue80@xxxxxxxxxxxxxxxxxxxxx
jb: people are stupid, they don't want to learn.
 Index: common/combat.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/combat.c,v
retrieving revision 1.32
diff -u -r1.32 combat.c
--- common/combat.c     2003/08/27 16:27:32     1.32
+++ common/combat.c     2003/09/09 22:10:05
@@ -581,6 +580,11 @@
    * also be able to spare units without full hp's to some extent, as these
    * could be more valuable later. */
   unit_list_iterate(ptile->units, defender) {
+    /* best defender is that we can't attack 
+     *  */
+    if (!can_unit_attack_unit_at_tile(attacker, defender, x ,y )) {
+      return defender;
+    }
     /* We used to skip over allied units, but the logic for that is
      * complicated and is now handled elsewhere. */
     if (unit_can_defend_here(defender)) {
 
 |  |