Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] Re: (PR#9862) Nasty bug in look_for_charge()
Home

[Freeciv-Dev] Re: (PR#9862) Nasty bug in look_for_charge()

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#9862) Nasty bug in look_for_charge()
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 29 Aug 2004 11:54:33 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9862 >

> We (I) should perhaps audit all use of bitshift operators in the AI and
> check if there are more of this kind of error.

Yep. One more. Patch attached.

  - Per

Index: ai/aiunit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v
retrieving revision 1.328
diff -u -r1.328 aiunit.c
--- ai/aiunit.c 25 Aug 2004 18:24:18 -0000      1.328
+++ ai/aiunit.c 29 Aug 2004 18:52:24 -0000
@@ -916,6 +916,9 @@
     }
     dist = unit_move_turns(punit, buddy->x, buddy->y);
     def = (toughness - unit_def_rating_basic_sq(buddy));
+    if (def <= 0) {
+      return;
+    }
     if (get_transporter_capacity(buddy) == 0) {
       /* Reduce want based on distance. We can't do this for
        * transports since they move around all the time, leading

[Prev in Thread] Current Thread [Next in Thread]