move wml [animate_unit] to lua

This commit is contained in:
Chris Beck 2014-12-24 15:15:25 -05:00
parent b6da5d0666
commit d7bf5be356
4 changed files with 15 additions and 6 deletions

View file

@ -1355,6 +1355,10 @@ function wml_actions.scroll(cfg)
wesnoth.scroll(cfg)
end
function wml_actions.animate_unit(cfg)
wesnoth.animate_unit(cfg)
end
function wml_actions.color_adjust(cfg)
wesnoth.color_adjust(cfg)
end

View file

@ -487,12 +487,6 @@ wml_action::wml_action(const std::string & tag, handler function)
static void wml_func_##pname(const queued_event& pei, const vconfig& pcfg)
WML_HANDLER_FUNCTION(animate_unit, event_info, cfg)
{
const events::command_disabler disable_commands;
unit_display::wml_animation(cfg, event_info.loc1);
}
/// Experimental data persistence
/// @todo Finish experimenting.
WML_HANDLER_FUNCTION(clear_global_variable,/**/,pcfg)

View file

@ -494,6 +494,16 @@ static int impl_unit_variables_set(lua_State *L)
return 0;
}
int game_lua_kernel::intf_animate_unit(lua_State *L)
{
// if (game_display_)
{
events::command_disabler disable_commands;
unit_display::wml_animation(luaW_checkvconfig(L, 1), get_event_info().loc1);
}
return 0;
}
int game_lua_kernel::intf_gamestate_inspector(lua_State *L)
{
if (game_display_) {

View file

@ -76,6 +76,7 @@ class game_lua_kernel : public lua_kernel_base
int intf_allow_undo(lua_State *);
int intf_add_time_area(lua_State *);
int intf_remove_time_area(lua_State *);
int intf_animate_unit(lua_State *);
int intf_gamestate_inspector(lua_State *);
int intf_get_unit(lua_State *);
int intf_get_units(lua_State *);