Remove unused counter_strength_ratio variable
Fix case where leader iterator was used after get_villages moved leader by passing reference to get_villages
This commit is contained in:
parent
febaf506bc
commit
a752e6a8e5
3 changed files with 5 additions and 8 deletions
|
@ -1073,7 +1073,7 @@ std::vector<std::pair<gamemap::location,gamemap::location> > ai::get_village_com
|
|||
}
|
||||
|
||||
|
||||
bool ai::get_villages(std::map<gamemap::location,paths>& possible_moves, const move_map& srcdst, const move_map& dstsrc, const move_map& enemy_srcdst, const move_map& enemy_dstsrc, unit_map::const_iterator leader)
|
||||
bool ai::get_villages(std::map<gamemap::location,paths>& possible_moves, const move_map& srcdst, const move_map& dstsrc, const move_map& enemy_srcdst, const move_map& enemy_dstsrc, unit_map::iterator &leader)
|
||||
{
|
||||
LOG_AI << "deciding which villages we want...\n";
|
||||
|
||||
|
@ -1181,8 +1181,10 @@ bool ai::get_villages(std::map<gamemap::location,paths>& possible_moves, const m
|
|||
|
||||
if(leader_move.second.valid()) {
|
||||
if(units_.count(leader_move.first) == 0) {
|
||||
move_unit(leader_move.second,leader_move.first,possible_moves);
|
||||
gamemap::location loc = move_unit(leader_move.second,leader_move.first,possible_moves);
|
||||
++moves_made;
|
||||
// Update leader iterator, since we moved it.
|
||||
leader = units_.find(loc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ protected:
|
|||
virtual void do_move();
|
||||
|
||||
virtual bool do_combat(std::map<gamemap::location,paths>& possible_moves, const move_map& srcdst, const move_map& dstsrc, const move_map& enemy_srcdst, const move_map& enemy_dstsrc);
|
||||
virtual bool get_villages(std::map<gamemap::location,paths>& possible_moves, const move_map& srcdst, const move_map& dstsrc, const move_map& enemy_srcdst, const move_map& enemy_dstsrc, unit_map::const_iterator leader);
|
||||
virtual bool get_villages(std::map<gamemap::location,paths>& possible_moves, const move_map& srcdst, const move_map& dstsrc, const move_map& enemy_srcdst, const move_map& enemy_dstsrc, unit_map::iterator &leader);
|
||||
virtual bool get_healing(std::map<gamemap::location,paths>& possible_moves, const move_map& srcdst, const move_map& enemy_dstsrc);
|
||||
virtual bool retreat_units(std::map<gamemap::location,paths>& possible_moves, const move_map& srcdst, const move_map& dstsrc, const move_map& enemy_dstsrc, unit_map::const_iterator leader);
|
||||
virtual bool move_to_targets(std::map<gamemap::location,paths>& possible_moves, move_map& srcdst, move_map& dstsrc, const move_map& enemy_dstsrc, unit_map::const_iterator leader);
|
||||
|
@ -144,10 +144,6 @@ protected:
|
|||
//(good for comparison to see just how good/bad 'terrain_quality' is)
|
||||
double alternative_terrain_quality;
|
||||
|
||||
//the ratio of the attacks the unit being attacked will get to
|
||||
//the strength of its most powerful attack
|
||||
double counter_strength_ratio;
|
||||
|
||||
//the vulnerability is the power projection of enemy units onto the hex
|
||||
//we're standing on. support is the power projection of friendly units.
|
||||
double vulnerability, support;
|
||||
|
|
|
@ -386,7 +386,6 @@ void ai::attack_analysis::analyze(const gamemap& map, unit_map& units, int num_s
|
|||
avg_damage_taken = 0.0;
|
||||
resources_used = 0.0;
|
||||
terrain_quality = 0.0;
|
||||
counter_strength_ratio = 0.0;
|
||||
avg_losses = 0.0;
|
||||
|
||||
const int target_max_hp = defend_it->second.max_hitpoints();
|
||||
|
|
Loading…
Add table
Reference in a new issue