From fbdd3262600bb681f17e68800329dae8448768b7 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Sun, 18 Jul 2010 16:29:08 +0000 Subject: [PATCH] Pass parameter by const ref instead of const value. Issue found by cppcheck. --- src/mouse_events.cpp | 4 +++- src/mouse_events.hpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mouse_events.cpp b/src/mouse_events.cpp index c3bf0d401e1..7fc0229e96b 100644 --- a/src/mouse_events.cpp +++ b/src/mouse_events.cpp @@ -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 diff --git a/src/mouse_events.hpp b/src/mouse_events.hpp index 74df0731887..28a3441e03a 100644 --- a/src/mouse_events.hpp +++ b/src/mouse_events.hpp @@ -98,7 +98,9 @@ protected: int fill_weapon_choices(std::vector& 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,