Author: cazfi Date: Thu May 18 11:03:06 2017 New Revision: 35632 URL: http://svn.gna.org/viewcvs/freeciv?rev=35632&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_5/common/unit.c Modified: branches/S2_5/common/unit.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/unit.c?rev=35632&r1=35631&r2=35632&view=diff ============================================================================== --- branches/S2_5/common/unit.c (original) +++ branches/S2_5/common/unit.c Thu May 18 11:03:06 2017 @@ -606,15 +606,15 @@ 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) { /* FIXME: This is just an approximation since we don't account for * get_activity_rate_this_turn. */ int speed = get_activity_rate(punit); int time = tile_activity_time(activity, ptile); - if (time >= 0 && speed >= 0) { + if (time >= 0 && speed > 0) { return (time - 1) / speed + 1; /* round up */ } else { return FC_INFINITY; _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits