fixed error in move_leader_to_keep part of ai_default,

...will get rid of wrong moves being considered, which were reported
by 'move_leader_to_keep failed!' messages
This commit is contained in:
Iurii Chernyi 2009-09-03 10:58:20 +00:00
parent 80626b67f5
commit 9ac85e36d7

View file

@ -746,10 +746,12 @@ void ai_default::move_leader_to_keep()
const int current_distance = distance_between(leader->first,keep);
foreach (const paths::step &dest, leader_paths.destinations)
{
const int new_distance = distance_between(dest.curr,keep);
if(new_distance < current_distance) {
moves_toward_keep.insert(std::make_pair(new_distance, dest.curr));
}
if (!units_.find(dest.curr).valid()){
const int new_distance = distance_between(dest.curr,keep);
if(new_distance < current_distance) {
moves_toward_keep.insert(std::make_pair(new_distance, dest.curr));
}
}
}
// Find the first location which we can move to,