Author: cazfi Date: Thu May 18 11:02:44 2017 New Revision: 35629 URL: http://svn.gna.org/viewcvs/freeciv?rev=35629&view=rev Log: Fix division by zero when unit activity rate is zero
Reported by David Fernandez (bard) See hrm Bug #660342 Modified: trunk/common/unit.c Modified: trunk/common/unit.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.c?rev=35629&r1=35628&r2=35629&view=diff ============================================================================== --- trunk/common/unit.c (original) +++ trunk/common/unit.c Thu May 18 11:02:44 2017 @@ -415,8 +415,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 @@ -424,7 +424,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