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:
Rusty Russell 2006-09-03 05:42:14 +00:00
parent 9518e55585
commit 376d5923d6

View File

@ -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()) {