Author: cazfi Date: Tue Feb 10 22:21:27 2015 New Revision: 28093 URL: http://svn.gna.org/viewcvs/freeciv?rev=28093&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_6/ai/default/daieffects.c Modified: branches/S2_6/ai/default/daieffects.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/daieffects.c?rev=28093&r1=28092&r2=28093&view=diff ============================================================================== --- branches/S2_6/ai/default/daieffects.c (original) +++ branches/S2_6/ai/default/daieffects.c Tue Feb 10 22:21:27 2015 @@ -450,14 +450,16 @@ } v += (amount/20 + ai->threats.invasions - 1) * c; /* for wonder */ if (capital || affects_land_capable_units) { - if (ai->threats.continent[tile_continent(pcity->tile)] + Continent_id place = tile_continent(pcity->tile); + + if ((place && 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 && 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