Author: cazfi Date: Thu May 18 11:02:58 2017 New Revision: 35631 URL: http://svn.gna.org/viewcvs/freeciv?rev=35631&view=rev Log: Fix division by zero when unit activity rate is zero
Reported by David Fernandez (bard) See hrm Bug #660342 Modified: branches/S2_6/common/unit.c Modified: branches/S2_6/common/unit.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/unit.c?rev=35631&r1=35630&r2=35631&view=diff ============================================================================== --- branches/S2_6/common/unit.c (original) +++ branches/S2_6/common/unit.c Thu May 18 11:02:58 2017 @@ -504,8 +504,8 @@ already done by this unit. **************************************************************************/ int get_turns_for_activity_at(const struct unit *punit, - enum unit_activity activity, - const struct tile *ptile, + enum unit_activity activity, + const struct tile *ptile, struct extra_type *tgt) { /* FIXME: This is just an approximation since we don't account for @@ -513,7 +513,7 @@ int speed = get_activity_rate(punit); int points_needed = tile_activity_time(activity, ptile, tgt); - if (points_needed >= 0 && speed >= 0) { + if (points_needed >= 0 && speed > 0) { return (points_needed - 1) / speed + 1; /* round up */ } else { return FC_INFINITY; _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits