Removed formula AI from start for default ai do_move() because it was buggy

Fixed bugs in move_leader_to_keep
This commit is contained in:
Pauli Nieminen 2008-09-16 20:00:03 +00:00
parent 92e5b791be
commit 987ad37b20
2 changed files with 7 additions and 6 deletions

View file

@ -536,7 +536,7 @@ gamemap::location ai_interface::move_unit_partial(location from, location to,
}
if(rt != p.routes.end()) {
assert(static_cast<size_t>(u_it->second.movement_left()) >= rt->second.steps.size()-1 && "Trying to move unit without enough move points left\n");
assert(static_cast<size_t>(u_it->second.movement_left()) >= rt->second.steps.size() && "Trying to move unit without enough move points left\n");
u_it->second.set_movement(rt->second.move_left);
std::vector<location> steps = rt->second.steps;
@ -1007,8 +1007,8 @@ void ai::do_move()
// Formula AI is first going to move everything that it can
if (master_)
static_cast<formula_ai*>(ai_manager::get_ai("formula_ai", info_).get())->play_turn();
// if (master_)
// static_cast<formula_ai*>(ai_manager::get_ai("formula_ai", info_).get())->play_turn();
typedef paths::route route;

View file

@ -817,6 +817,7 @@ void ai::move_leader_to_keep(const move_map& enemy_dstsrc)
const int number_of_recruit = current_team().gold() / current_team().average_recruit_price();
// If the leader is not on his starting location, move him there.
if (number_of_recruit)
{
{
// Make a map of the possible locations the leader can move to,
@ -865,8 +866,8 @@ void ai::move_leader_to_keep(const move_map& enemy_dstsrc)
gamemap::location target;
if (distance > leader->second.movement_left())
{
target = route->second.steps[leader->second.movement_left()+1];
route->second.steps.erase(route->second.steps.begin() + leader->second.movement_left(),route->second.steps.end());
target = route->second.steps[leader->second.movement_left()];
route->second.steps.erase(route->second.steps.begin() + leader->second.movement_left() + 1,route->second.steps.end());
route->second.move_left = 0;
} else {
target = *i;
@ -874,7 +875,7 @@ void ai::move_leader_to_keep(const move_map& enemy_dstsrc)
}
best_value = value;
best_target = target;
ERR_AI << "Considiring keep: " << *i <<
DBG_AI << "Considiring keep: " << *i <<
" empty slots: " << empty_slots <<
" distance: " << distance <<
" enemy: " << enemy <<