Author: cazfi
Date: Tue Feb 10 22:21:34 2015
New Revision: 28094

URL: http://svn.gna.org/viewcvs/freeciv?rev=28094&view=rev
Log:
Fixed an illegal array index usage in AI effect value evaluation
when handling an city on ocean.

See bug #23250

Modified:
    branches/S2_5/ai/default/aicity.c

Modified: branches/S2_5/ai/default/aicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/ai/default/aicity.c?rev=28094&r1=28093&r2=28094&view=diff
==============================================================================
--- branches/S2_5/ai/default/aicity.c   (original)
+++ branches/S2_5/ai/default/aicity.c   Tue Feb 10 22:21:34 2015
@@ -1417,14 +1417,16 @@
     }
     v += (amount/20 + ai->threats.invasions - 1) * c; /* for wonder */
     if (capital || uclass == NULL || move != UMT_SEA) {
-      if (ai->threats.continent[tile_continent(pcity->tile)]
+      Continent_id place = tile_continent(pcity->tile);
+
+      if ((place > 0 && ai->threats.continent[place])
           || capital
           || (ai->threats.invasions
               /* FIXME: This ignores riverboats on some rulesets.
                         We should analyze rulesets when game starts
                         and have relevant checks here. */
               && is_terrain_class_near_tile(pcity->tile, TC_OCEAN))) {
-        if (ai->threats.continent[tile_continent(pcity->tile)]) {
+        if (place > 0 && ai->threats.continent[place]) {
           v += amount;
         } else {
           v += amount / (!ai->threats.igwall ? (15 - capital * 5) : 15);


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to