Move animationless moving unit hiding to a more appropriate place
Unit hiding is usually done in replace_temporary, which is called by proceed_to. As proceed_to exits at the beginning if animate is false, this would seem like a good place to hide the unit, but it is also unhidden during this function. This means that was_hidden_ is set multiple times, with the second time overwriting it with the temporary state of being hidden. As animate remains false for the entire lifetime of the unit mover, we hide it at the start and let finish unhide it again. Reported at http://r.wesnoth.org/p570866
This commit is contained in:
parent
30c179b92d
commit
e701fe68b0
1 changed files with 8 additions and 10 deletions
|
@ -244,8 +244,14 @@ void unit_mover::update_shown_unit()
|
|||
void unit_mover::start(unit& u)
|
||||
{
|
||||
// Nothing to do here if there is nothing to animate.
|
||||
if ( !can_draw_ || !animate_ )
|
||||
if ( !can_draw_ )
|
||||
return;
|
||||
// If no animation then hide unit until end of movement
|
||||
if ( !animate_ ) {
|
||||
was_hidden_ = u.get_hidden();
|
||||
u.set_hidden(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// This normally does nothing, but just in case...
|
||||
wait_for_anims();
|
||||
|
@ -309,17 +315,9 @@ void unit_mover::start(unit& u)
|
|||
void unit_mover::proceed_to(unit& u, size_t path_index, bool update, bool wait)
|
||||
{
|
||||
// Nothing to do here if animations cannot be shown.
|
||||
if ( !can_draw_ )
|
||||
if ( !can_draw_ || !animate_ )
|
||||
return;
|
||||
|
||||
// If no animation then hide unit until end of movement
|
||||
if (!animate_)
|
||||
{
|
||||
was_hidden_ = u.get_hidden();
|
||||
u.set_hidden(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle pending visibility issues before introducing new ones.
|
||||
wait_for_anims();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue