Whiteboard: fix the problem of units being unhidden...

...before their movement was finished animating. Fixes bug #16415.
This commit is contained in:
Gabriel Morin 2010-08-13 07:37:45 +00:00
parent 1ac05aef64
commit eeb5bd07aa

View file

@ -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