Skip to content

Commit

Permalink
Move open_help to the gui module
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Mar 4, 2021
1 parent 64594eb commit ec853ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions data/lua/core/gui.lua
Expand Up @@ -154,3 +154,6 @@ wesnoth.get_dialog_value = wesnoth.deprecate_api('wesnoth.get_dialog_value', val
wesnoth.add_dialog_tree_node = wesnoth.deprecate_api('wesnoth.add_dialog_tree_node', '<widget>:add_item_of_type', 1, nil, add_dialog_tree_node)
wesnoth.remove_dialog_item = wesnoth.deprecate_api('wesnoth.remove_dialog_item', '<widget>:remove_items_at', 1, nil, remove_dialog_item)
wesnoth.show_dialog = wesnoth.deprecate_api('wesnoth.show_dialog', 'gui.show_dialog', 1, nil, gui.show_dialog)
if wesnoth.kernel_type() == "Game Lua Kernel" then
wesnoth.open_help = wesnoth.deprecate_api('wesnoth.open_help', 'gui.open_help', 1, nil, gui.open_help)
end
7 changes: 6 additions & 1 deletion src/scripting/game_lua_kernel.cpp
Expand Up @@ -3948,7 +3948,6 @@ game_lua_kernel::game_lua_kernel(game_state & gs, play_controller & pc, reports
{ "log_replay", &dispatch<&game_lua_kernel::intf_log_replay > },
{ "log", &dispatch<&game_lua_kernel::intf_log > },
{ "message", &dispatch<&game_lua_kernel::intf_message > },
{ "open_help", &dispatch<&game_lua_kernel::intf_open_help > },
{ "print", &dispatch<&game_lua_kernel::intf_print > },
{ "redraw", &dispatch<&game_lua_kernel::intf_redraw > },
{ "remove_event_handler", &dispatch<&game_lua_kernel::intf_remove_event > },
Expand Down Expand Up @@ -4081,6 +4080,12 @@ game_lua_kernel::game_lua_kernel(game_state & gs, play_controller & pc, reports
luaL_setfuncs(L, map_callbacks, 0);
lua_pop(L, 1);

// Add open_help to the GUI module
lua_getglobal(L, "gui");
lua_pushcfunction(L, &dispatch<&game_lua_kernel::intf_open_help>);
lua_setfield(L, -2, "open_help");
lua_pop(L, 1);

// Create the units module
cmd_log_ << "Adding units module...\n";
static luaL_Reg const unit_callbacks[] {
Expand Down

0 comments on commit ec853ff

Please sign in to comment.