Pass parameter by const ref instead of const value.

Issue found by cppcheck.
This commit is contained in:
Mark de Wever 2010-07-18 16:29:08 +00:00
parent dd09a963da
commit fbdd326260
2 changed files with 6 additions and 2 deletions

View File

@ -861,7 +861,9 @@ void mouse_handler::attack_enemy(const map_location& attacker_loc, const map_loc
}
}
void mouse_handler::attack_enemy_(const map_location attacker_loc, const map_location defender_loc, int choice)
void mouse_handler::attack_enemy_(const map_location& attacker_loc
, const map_location& defender_loc
, int choice)
{
//we must get locations by value instead of by references,
//because unit_map changes may affect them if from unit_map::iterator

View File

@ -98,7 +98,9 @@ protected:
int fill_weapon_choices(std::vector<battle_context>& bc_vector, unit_map::iterator attacker, unit_map::iterator defender);
// the real function but can throw bad_alloc
// choice is the attack chosen in the attack dialog
void attack_enemy_(const map_location attacker_loc, const map_location defender_loc, int choice);
void attack_enemy_(const map_location& attacker_loc
, const map_location& defender_loc
, int choice);
// the perform attack function called after a random seed is obtained
void perform_attack(map_location attacker_loc, map_location defender_loc,