Author: cazfi
Date: Sun Feb  8 07:12:02 2015
New Revision: 28030

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

See bug #23230

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

Modified: branches/S2_6/ai/default/aicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/aicity.c?rev=28030&r1=28029&r2=28030&view=diff
==============================================================================
--- branches/S2_6/ai/default/aicity.c   (original)
+++ branches/S2_6/ai/default/aicity.c   Sun Feb  8 07:12:02 2015
@@ -1339,6 +1339,7 @@
   };
   const bool is_coinage = improvement_has_flag(pimprove, IF_GOLD);
   int turns = 9999;
+  int place = tile_continent(pcity->tile);
 
   /* Remove team members from the equation */
   players_iterate(aplayer) {
@@ -1381,7 +1382,11 @@
   cities[REQ_RANGE_WORLD] = cities[REQ_RANGE_ALLIANCE] = cities[REQ_RANGE_TEAM]
     = cities[REQ_RANGE_PLAYER];
 
-  cities[REQ_RANGE_CONTINENT] = ai->stats.cities[tile_continent(pcity->tile)];
+  if (place < 0) {
+    cities[REQ_RANGE_CONTINENT] = 1;
+  } else {
+    cities[REQ_RANGE_CONTINENT] = ai->stats.cities[place];
+  }
 
   /* All the trade partners and the city being considered. */
   cities[REQ_RANGE_TRADEROUTE] = city_num_trade_routes(pcity)+1;


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

Reply via email to