Return sum instead of zero in case a division by zero would appears.

There are cases where sum isn't 0 if weight_sum is.
This commit is contained in:
Jon Daniel 2005-01-22 16:43:09 +00:00
parent 1ef762ec61
commit 76ac4d9d07

View file

@ -1376,7 +1376,7 @@ int ai::average_resistance_against(const unit_type& a, const unit_type& b) const
// if it has no attack at all the ai shouldn't prefer
// that unit anyway
if (weight_sum == 0) {
return 0;
return sum;
}
return sum/weight_sum;
}