mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-05 16:24:58 +00:00
Fix bug #6804 (infinite loop in AI retreat phase).
We kept trying to desperate attack, even without attacks remaining, giving infinite recursion.
This commit is contained in:
parent
9518e55585
commit
376d5923d6
@ -1339,7 +1339,10 @@ bool ai::retreat_units(std::map<gamemap::location,paths>& possible_moves, const
|
||||
|
||||
// If we can't move, we should be more aggressive in lashing out.
|
||||
if (best_pos == i->first) {
|
||||
return desperate_attack(i->first);
|
||||
if (i->second.attacks_left()) {
|
||||
return desperate_attack(i->first);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(best_pos.valid()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user