Author: cazfi Date: Wed Feb 4 03:56:43 2015 New Revision: 27952 URL: http://svn.gna.org/viewcvs/freeciv?rev=27952&view=rev Log: Fixed a illegal array index usage in building advisor when handling an city on ocean.
See bug #23227 Modified: branches/S2_5/server/advisors/advbuilding.c Modified: branches/S2_5/server/advisors/advbuilding.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/advisors/advbuilding.c?rev=27952&r1=27951&r2=27952&view=diff ============================================================================== --- branches/S2_5/server/advisors/advbuilding.c (original) +++ branches/S2_5/server/advisors/advbuilding.c Wed Feb 4 03:56:43 2015 @@ -221,16 +221,18 @@ * continent. */ if (first_role_unit_for_player(pplayer, UTYF_HELP_WONDER)) { value += city_data->downtown; - value += adv->stats.cities[place] / 8; - } - if (adv->threats.continent[place] > 0) { + if (place >= 0) { + value += adv->stats.cities[place] / 8; + } + } + if (place >= 0 && adv->threats.continent[place] > 0) { /* We have threatening neighbours: -25% */ value -= value / 4; } /* Require that there is at least some neighbors for wonder helpers, * if ruleset supports it. */ if (value > best_candidate_value - && (!has_help || adv->stats.cities[place] > 5) + && (!has_help || (place >= 0 && adv->stats.cities[place] > 5)) && (!has_help || city_data->downtown > 3)) { best_candidate = pcity; best_candidate_value = value; _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits