Skip to content

Commit

Permalink
Move create_animator and create_weapon into the units module
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Feb 21, 2021
1 parent 7fc8008 commit 7196130
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions data/lua/core/units.lua
Expand Up @@ -70,4 +70,6 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
wesnoth.get_unit = wesnoth.deprecate_api('wesnoth.get_unit', 'wesnoth.units.get', 1, nil, wesnoth.units.get)
wesnoth.get_units = wesnoth.deprecate_api('wesnoth.get_units', 'wesnoth.units.find_on_map', 1, nil, wesnoth.units.find_on_map)
wesnoth.get_recall_units = wesnoth.deprecate_api('wesnoth.get_units', 'wesnoth.units.find_on_recall', 1, nil, wesnoth.units.find_on_recall)
wesnoth.create_animator = wesnoth.deprecate_api('wesnoth.create_animator', 'wesnoth.units.create_animator', 1, nil, wesnoth.units.create_animator)
wesnoth.create_weapon = wesnoth.deprecate_api('wesnoth.create_weapon', 'wesnoth.units.create_weapon', 1, nil, wesnoth.units.create_weapon)
end
2 changes: 1 addition & 1 deletion src/scripting/game_lua_kernel.cpp
Expand Up @@ -4114,7 +4114,6 @@ game_lua_kernel::game_lua_kernel(game_state & gs, play_controller & pc, reports
// Put some callback functions in the scripting environment.
static luaL_Reg const callbacks[] {
{ "add_known_unit", &intf_add_known_unit },
{ "create_animator", &dispatch<&game_lua_kernel::intf_create_animator> },
{ "eval_conditional", &intf_eval_conditional },
{ "get_era", &intf_get_era },
{ "get_resource", &intf_get_resource },
Expand Down Expand Up @@ -4278,6 +4277,7 @@ game_lua_kernel::game_lua_kernel(game_state & gs, play_controller & pc, reports
{"find_on_recall", &dispatch<&game_lua_kernel::intf_get_recall_units>},
{"get", &dispatch<&game_lua_kernel::intf_get_unit>},
{"get_hovered", &dispatch<&game_lua_kernel::intf_get_displayed_unit>},
{"create_animator", &dispatch<&game_lua_kernel::intf_create_animator>},
{ nullptr, nullptr }
};
lua_getglobal(L, "wesnoth");
Expand Down
2 changes: 1 addition & 1 deletion src/scripting/lua_unit_attacks.cpp
Expand Up @@ -391,7 +391,7 @@ namespace lua_units {
lua_setfield(L, -2, "matches");

// Add create_attack
luaW_getglobal(L, "wesnoth");
luaW_getglobal(L, "wesnoth", "units");
lua_pushcfunction(L, intf_create_attack);
lua_setfield(L, -2, "create_weapon");
lua_pop(L, 1);
Expand Down

0 comments on commit 7196130

Please sign in to comment.