Author: cazfi Date: Thu May 18 11:16:05 2017 New Revision: 35633 URL: http://svn.gna.org/viewcvs/freeciv?rev=35633&view=rev Log: Make sure veterancy of the newly built unit is not negative
Reported by David Fernandez (bard) See hrm Bug #661193 Modified: trunk/server/citytools.c Modified: trunk/server/citytools.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/citytools.c?rev=35633&r1=35632&r2=35633&view=diff ============================================================================== --- trunk/server/citytools.c (original) +++ trunk/server/citytools.c Thu May 18 11:16:05 2017 @@ -571,9 +571,13 @@ int do_make_unit_veteran(struct city *pcity, const struct unit_type *punittype) { - return MIN(get_unittype_bonus(city_owner(pcity), pcity->tile, punittype, - EFT_VETERAN_BUILD), - utype_veteran_levels(punittype) - 1); + int levels = get_unittype_bonus(city_owner(pcity), pcity->tile, punittype, + EFT_VETERAN_BUILD); + int max_levels = utype_veteran_levels(punittype) - 1; + + levels = CLIP(0, levels, max_levels); + + return levels; } /********************************************************************* _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits