Fix bug #9103 (Floating-point exception during turn resolution of Black Flag)

I think the bug comes from unit with 0 movements (towers)
I suppose that AI choices is not very important for them,
but maybe check what default value use.
This commit is contained in:
Ali El Gariani 2007-05-10 14:03:15 +00:00
parent edb21df784
commit b147435da1

View File

@ -1551,7 +1551,8 @@ int ai::average_resistance_against(const unit_type& a, const unit_type& b) const
weighting_sum += j->second;
}
defense /= weighting_sum;
if (weighting_sum != 0)
defense /= weighting_sum;
LOG_AI << "average defense of '" << a.id() << "': " << defense << "\n";