Complete.Org: Mailing Lists: Archives: freeciv-ai: August 2004:
[freeciv-ai] (PR#9877) Reproducable crash with Freeciv compiled from cur
Home

[freeciv-ai] (PR#9877) Reproducable crash with Freeciv compiled from cur

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: tim.kosse@xxxxxx
Subject: [freeciv-ai] (PR#9877) Reproducable crash with Freeciv compiled from current CVS HEAD (20040830 1700 UTC)
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Mon, 30 Aug 2004 14:09:05 -0700
Reply-to: rt@xxxxxxxxxxx

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

> [glip - Mon Aug 30 20:54:07 2004]:
> Mateusz,
> 
> How about checking if the current tile is an ocean and then doing 
> iteration if it isn't.  saves some ticks.
Like this?
--
mateusz
Index: aidata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.c,v
retrieving revision 1.35
diff -u -r1.35 aidata.c
--- aidata.c    30 Aug 2004 20:51:41 -0000      1.35
+++ aidata.c    30 Aug 2004 21:08:36 -0000
@@ -97,12 +97,17 @@
         /* The idea is that while our enemies don't have any offensive
          * seaborne units, we don't have to worry. Go on the offensive! */
         if (unit_type(punit)->attack_strength > 1) {
-         square_iterate(punit->x, punit->y, 1, x2, y2) {
-           if (is_ocean(map_get_terrain(x2, y2))) {
-             Continent_id continent = map_get_continent(x2, y2);
-             ai->threats.ocean[-continent] = TRUE;
-           }
-         } square_iterate_end;
+         if (is_ocean(map_get_terrain(punit->x, punit->y))) {
+           Continent_id continent = map_get_continent(punit->x, punit->y);
+           ai->threats.ocean[-continent] = TRUE;
+         } else {
+           adjc_iterate(punit->x, punit->y, x2, y2) {
+             if (is_ocean(map_get_terrain(x2, y2))) {
+               Continent_id continent = map_get_continent(x2, y2);
+               ai->threats.ocean[-continent] = TRUE;
+             }
+           } adjc_iterate_end;
+         }
         } 
         continue;
       }

[Prev in Thread] Current Thread [Next in Thread]
  • [freeciv-ai] (PR#9877) Reproducable crash with Freeciv compiled from current CVS HEAD (20040830 1700 UTC), Mateusz Stefek <=