mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-20 04:31:19 +00:00
Pass parameter by const ref instead of const value.
Issue found by cppcheck.
This commit is contained in:
parent
dd09a963da
commit
fbdd326260
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user