mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-06 17:43:27 +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,8 +1339,11 @@ 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 we can't move, we should be more aggressive in lashing out.
|
||||||
if (best_pos == i->first) {
|
if (best_pos == i->first) {
|
||||||
|
if (i->second.attacks_left()) {
|
||||||
return desperate_attack(i->first);
|
return desperate_attack(i->first);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(best_pos.valid()) {
|
if(best_pos.valid()) {
|
||||||
LOG_AI << "retreating '" << i->second.id() << "' " << i->first
|
LOG_AI << "retreating '" << i->second.id() << "' " << i->first
|
||||||
|
Loading…
x
Reference in New Issue
Block a user