mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-07 01:34:38 +00:00
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:
parent
edb21df784
commit
b147435da1
@ -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";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user