Skip to content

Commit

Permalink
Lua API reorganization: interface module deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Mar 24, 2018
1 parent 79ffbd5 commit ed81085
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
16 changes: 16 additions & 0 deletions data/lua/core.lua
Expand Up @@ -491,6 +491,22 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
wesnoth.get_variable = wesnoth.deprecate_api('wesnoth.get_variable', 'wml.variables', 1, nil, wesnoth.get_variable)
wesnoth.set_variable = wesnoth.deprecate_api('wesnoth.set_variable', 'wml.variables', 1, nil, wesnoth.set_variable)
wesnoth.get_all_vars = wesnoth.deprecate_api('wesnoth.get_all_vars', 'wml.all_variables', 1, nil, wesnoth.get_all_vars)
-- Interface module
wesnoth.delay = wesnoth.deprecate_api('wesnoth.delay', 'wesnoth.intf.delay', 1, nil, wesnoth.intf.delay)
wesnoth.float_label = wesnoth.deprecate_api('wesnoth.float_label', 'wesnoth.intf.float_label', 1, nil, wesnoth.intf.float_label)
wesnoth.select_unit = wesnoth.deprecate_api('wesnoth.select_unit', 'wesnoth.intf.select_unit', 1, nil, wesnoth.intf.select_unit)
wesnoth.highlight_hex = wesnoth.deprecate_api('wesnoth.highlight_hex', 'wesnoth.intf.highlight_hex', 1, nil, wesnoth.intf.highlight_hex)
wesnoth.deselect_hex = wesnoth.deprecate_api('wesnoth.deselect_hex', 'wesnoth.intf.deselect_hex', 1, nil, wesnoth.intf.deselect_hex)
wesnoth.get_selected_tile = wesnoth.deprecate_api('wesnoth.get_selected_tile', 'wesnoth.intf.get_selected_hex', 1, nil, wesnoth.intf.get_selected_)
wesnoth.scroll_to_tile = wesnoth.deprecate_api('wesnoth.scroll_to_tile', 'wesnot.intf.scroll_to_hex', 1, nil, wesnoth.intf.scroll_to_hex)
wesnoth.lock_view = wesnoth.deprecate_api('wesnoth.lock_view', 'wesnoth.intf.lock', 1, nil, wesnoth.intf.lock)
wesnoth.view_locked = wesnoth.deprecate_api('wesnoth.view_locked', 'wesnoth.intf.is_locked', 1, nil, wesnoth.intf.is_locked)
wesnoth.is_skipping_messages = wesnoth.deprecate_api('wesnoth.is_skipping_messages', 'wesnoth.intf.is_skipping_messages', 1, nil, wesnoth.intf.is_skipping_messages)
wesnoth.skip_messages = wesnoth.deprecate_api('wesnoth.skip_messages', 'wesnoth.intf.skip_messages', 1, nil, wesnoth.intf.skip_messages)
wesnoth.add_tile_overlay = wesnoth.deprecate_api('wesnoth.add_tile_overlay', 'wesnoth.intf.add_hex_overlay', 1, nil, wesnoth.intf.add_hex_overlay)
wesnoth.remove_tile_overlay = wesnoth.deprecate_api('wesnoth.remove_tile_overlay', 'wesnoth.intf.remove_hex_overlay', 1, nil, wesnoth.intf.remove_hex_overlay)
wesnoth.theme_items = wesnoth.deprecate_api('wesnoth.theme_items', 'wesnoth.intf.game_display', 1, nil, wesnoth.intf.game_display)
wesnoth.get_displayed_unit = wesnoth.deprecate_api('wesnoth.get_displayed_unit', 'wesnoth.intf.get_displayed_unit', 1, nil, wesnoth.intf.get_displayed_unit)
end
wesnoth.tovconfig = wesnoth.deprecate_api('wesnoth.tovconfig', 'wml.tovconfig', 1, nil, wesnoth.tovconfig)
wesnoth.debug = wesnoth.deprecate_api('wesnoth.debug', 'wml.tostring', 1, nil, wesnoth.debug)
1 change: 1 addition & 0 deletions data/lua/helper.lua
Expand Up @@ -296,5 +296,6 @@ helper.shallow_literal = wesnoth.deprecate_api('helper.shallow_literal', 'wml.sh
helper.shallow_parsed = wesnoth.deprecate_api('helper.shallow_parsed', 'wml.shallow_parsed', 1, nil, wml.shallow_parsed)
helper.set_wml_var_metatable = wesnoth.deprecate_api('helper.set_wml_var_metatable', 'wml.variable.proxy', 2, nil, helper.set_wml_var_metatable)
helper.set_wml_tag_metatable = wesnoth.deprecate_api('helper.set_wml_tag_metatable', 'wml.tag', 2, nil, helper.set_wml_tag_metatable)
helper.move_unit_fake = wesnoth.deprecate_api('helper.move_unit_fake', 'wesnoth.intf.move_unit_fake', 1, nil, wesnoth.intf.move_unit_fake)

return helper
12 changes: 9 additions & 3 deletions data/lua/wml/items.lua
Expand Up @@ -102,18 +102,24 @@ function wml_actions.store_items(cfg)
end
end

local methods = { remove = remove_overlay }
wesnoth.intf.remove_item = remove_overlay

function methods.place_image(x, y, name)
function wesnoth.intf.add_item_image(x, y, name)
add_overlay(x, y, { x = x, y = y, image = name })
end

function methods.place_halo(x, y, name)
function wesnoth.intf.add_item_halo(x, y, name)
add_overlay(x, y, { x = x, y = y, halo = name })
end

wesnoth.intf.remove_item = methods.remove
wesnoth.intf.add_item_image = methods.place_image
wesnoth.intf.add_item_halo = methods.place_halo

local methods = {
remove = wesnoth.deprecate_api('items.remove', 'wesnoth.intf.remove_item', 1, nil, remove_overlay),
place_image = wesnoth.deprecate_api('items.place_image', 'wesnoth.intf.add_item_image', 1, nil, wesnoth.intf.add_item_image),
place_halo = wesnoth.deprecate_api('items.place_halo', 'wesnoth.intf.add_item_halo', 1, nil, wesnoth.intf.add_item_halo)
}

return methods

0 comments on commit ed81085

Please sign in to comment.