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:
parent
1ef762ec61
commit
76ac4d9d07
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue