Fix nasty bug (probable crash)...

when user left-clicks while their unit is already moving: recursion in
move_unit.

Found under valgrind (it was slow enough to see double-move, too!)
This commit is contained in:
Rusty Russell 2006-06-01 08:29:05 +00:00
parent 6c032e37b8
commit 17c7c86d05

View file

@ -1016,7 +1016,7 @@ void mouse_handler::left_click(const SDL_MouseButtonEvent& event, const bool bro
paths orig_paths = current_paths_;
//see if we're trying to do a move-and-attack
if(!browse && u != units_.end() && enemy != units_.end() && !current_route_.steps.empty()) {
if(!browse && !commands_disabled && u != units_.end() && enemy != units_.end() && !current_route_.steps.empty()) {
const gamemap::location& attack_from = current_unit_attacks_from(hex, nearest_hex, second_nearest_hex);
if(attack_from.valid()) {
if(move_unit_along_current_route(false)) { //move the unit without updating shroud