fixed error in move_leader_to_keep part of testing_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:26 +00:00
parent 9ac85e36d7
commit e4d2f51207

View File

@ -755,11 +755,13 @@ double move_leader_to_keep_phase::evaluate()
const int current_distance = distance_between(leader->first,keep);
foreach (const paths::step &dest, leader_paths.destinations)
{
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,
// without the threat of enemies.