Lua API: implicitly clear animator after playing it (#3536)
This prevents the animator from holding a strong reference to the target unit, which was keeping the unit object alive and thus preventing the unit halo, if any, from disappearing.
This commit is contained in:
parent
6eba0cbace
commit
7d6e2b2a10
4 changed files with 2 additions and 4 deletions
|
@ -110,5 +110,4 @@ function wesnoth.wml_actions.animate_unit(cfg)
|
|||
local anim = wesnoth.create_animator()
|
||||
add_animation(anim, cfg)
|
||||
anim:run()
|
||||
anim:clear()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,7 +44,6 @@ function wesnoth.wml_actions.heal_unit(cfg)
|
|||
animator:add(healers[1], 'healing', 'hit', {value = heal_amount})
|
||||
end
|
||||
animator:run()
|
||||
animator:clear()
|
||||
end
|
||||
|
||||
u.hitpoints = new_hitpoints
|
||||
|
|
|
@ -71,7 +71,6 @@ function wesnoth.wml_actions.kill(cfg)
|
|||
anim:add(secondary_unit, "victory", "kill", {primary = secondary, secondary = primary})
|
||||
end
|
||||
anim:run()
|
||||
anim:clear()
|
||||
end
|
||||
-- wesnoth.wml_actions.redraw{}
|
||||
|
||||
|
|
|
@ -449,6 +449,7 @@ static int impl_run_animation(lua_State* L)
|
|||
anim.start_animations();
|
||||
anim.wait_for_end();
|
||||
anim.set_all_standing();
|
||||
anim.clear();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue