From eeb5bd07aa406be47f8583922bbd2467a1f03d84 Mon Sep 17 00:00:00 2001 From: Gabriel Morin Date: Fri, 13 Aug 2010 07:37:45 +0000 Subject: [PATCH] Whiteboard: fix the problem of units being unhidden... ...before their movement was finished animating. Fixes bug #16415. --- src/whiteboard/highlight_visitor.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/whiteboard/highlight_visitor.cpp b/src/whiteboard/highlight_visitor.cpp index 5b1cbf5e439..42beac2575e 100644 --- a/src/whiteboard/highlight_visitor.cpp +++ b/src/whiteboard/highlight_visitor.cpp @@ -103,11 +103,14 @@ void highlight_visitor::highlight() if (action_ptr main = main_highlight_.lock()) { //Hide any "present" unit that gets in the way - unit* hide_me = get_visible_unit(mouseover_hex_, - resources::teams->at(side_actions_->team_index()),false); - if (hide_me && hide_me->side() == int(side_actions_->team_index()) + 1) + if (!events::commands_disabled) //< don't do it e.g. during unit movement { - hide_me->set_hidden(true); + unit* hide_me = get_visible_unit(mouseover_hex_, + resources::teams->at(side_actions_->team_index()),false); + if (hide_me && hide_me->side() == int(side_actions_->team_index()) + 1) + { + hide_me->set_hidden(true); + } } //Highlight main highlight @@ -139,14 +142,19 @@ void highlight_visitor::unhighlight() mode_ = UNHIGHLIGHT; //unhighlight main highlight if (action_ptr main = main_highlight_.lock() ) + { main->accept(*this); - //Unhide the other unit in the hex if it was hidden - unit* unhide_me = get_visible_unit(mouseover_hex_, - resources::teams->at(side_actions_->team_index()),false); - if (unhide_me && unhide_me->side() == int(side_actions_->team_index()) + 1) - { - unhide_me->set_hidden(false); + //Unhide the other unit in the hex if it was hidden + if (!events::commands_disabled) //< don't do it e.g. during unit movement + { + unit* unhide_me = get_visible_unit(mouseover_hex_, + resources::teams->at(side_actions_->team_index()),false); + if (unhide_me && unhide_me->side() == int(side_actions_->team_index()) + 1) + { + unhide_me->set_hidden(false); + } + } } //unhighlight secondary highlights