Remove the now useless multistep_move_possible,

...as pointed by Crab_: "with RCA ai, it's no longer necessary, as 'go
to keep' is more high-priority action."
This commit is contained in:
Ali El Gariani 2010-06-16 14:34:52 +00:00
parent 2b89fee136
commit 3fb30065e9
3 changed files with 1 additions and 74 deletions

View file

@ -101,50 +101,6 @@ default_ai_context& default_ai_context_impl::get_default_ai_context(){
}
bool default_ai_context_impl::multistep_move_possible(const map_location& from,
const map_location& to, const map_location& via,
const moves_map& possible_moves) const
{
unit_map &units_ = *resources::units;
const unit_map::const_iterator i = units_.find(from);
if(i != units_.end()) {
if(from != via && to != via && units_.count(via) == 0) {
LOG_AI << "when seeing if leader can move from "
<< from << " -> " << to
<< " seeing if can detour to keep at " << via << '\n';
const std::map<map_location,pathfind::paths>::const_iterator moves = possible_moves.find(from);
if(moves != possible_moves.end()) {
LOG_AI << "found leader moves..\n";
// See if the unit can make it to 'via', and if it can,
// how much movement it will have left when it gets there.
pathfind::paths::dest_vect::const_iterator itor =
moves->second.destinations.find(via);
if (itor != moves->second.destinations.end())
{
LOG_AI << "Can make it to keep with " << itor->move_left << " movement left.\n";
unit temp_unit(*i);
temp_unit.set_movement(itor->move_left);
const temporary_unit_placer unit_placer(units_,via,temp_unit);
const pathfind::paths unit_paths(*resources::game_map,units_,via,*resources::teams,false,false,current_team());
LOG_AI << "Found " << unit_paths.destinations.size() << " moves for temp leader.\n";
// See if this leader could make it back to the keep.
if (unit_paths.destinations.contains(to)) {
LOG_AI << "can make it back to the keep\n";
return true;
}
}
}
}
}
return false;
}
int default_ai_context_impl::rate_terrain(const unit& u, const map_location& loc) const
{
gamemap &map_ = *resources::game_map;

View file

@ -165,11 +165,6 @@ public:
virtual std::vector<target> find_targets(const move_map& enemy_dstsrc) = 0;
virtual bool multistep_move_possible(const map_location& from,
const map_location& to, const map_location& via,
const moves_map& possible_moves) const = 0;
virtual int rate_terrain(const unit& u, const map_location& loc) const = 0;
@ -231,14 +226,6 @@ public:
void init_default_ai_context_proxy(default_ai_context &target);
virtual bool multistep_move_possible(const map_location& from,
const map_location& to, const map_location& via,
const moves_map& possible_moves) const
{
return target_->multistep_move_possible(from,to,via,possible_moves);
}
virtual int rate_terrain(const unit& u, const map_location& loc) const
{
return target_->rate_terrain(u,loc);
@ -292,11 +279,6 @@ public:
virtual std::vector<target> find_targets(const move_map& enemy_dstsrc);
virtual bool multistep_move_possible(const map_location& from,
const map_location& to, const map_location& via,
const moves_map& possible_moves) const;
virtual int rate_terrain(const unit& u, const map_location& loc) const;

View file

@ -936,7 +936,7 @@ void get_villages_phase::find_villages(
treachmap& reachmap,
tmoves& moves,
const std::multimap<map_location,map_location>& dstsrc,
const std::map<map_location,pathfind::paths>& possible_moves,
const std::map<map_location,pathfind::paths>& /*possible_moves*/,
const std::multimap<map_location,map_location>& enemy_dstsrc)
{
@ -1000,17 +1000,6 @@ void get_villages_phase::find_villages(
continue;
}
// If we have a decent amount of gold, and the leader can't access
// the keep this turn if they get this village,
// then don't get this village with them.
if(want_village &&
current_team().gold() > 20 &&
leader_loc_ == current_loc &&
leader_loc_ != keep_loc_ &&
multistep_move_possible(j->second, current_loc, keep_loc_, possible_moves) == false) {
continue;
}
double threat = 0.0;
const std::map<map_location,double>::const_iterator vuln = vulnerability.find(current_loc);
if(vuln != vulnerability.end()) {