Lua fixes

This commit is contained in:
Jyrki Vesterinen 2018-11-16 05:47:28 +02:00
parent 866420adf8
commit 68f3a8e846
2 changed files with 14 additions and 13 deletions

View file

@ -394,7 +394,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
end
return result
end
-- More convenient when accessing global variables
wml.array_variables = setmetatable({}, {
__metatable = "WML variables",
@ -413,7 +413,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
return t[k]
end
})
-- Note: We don't save the old on_load and on_save here.
-- It's not necessary because we know this will be the first one registered.
function wesnoth.game_events.on_load(cfg)
@ -445,6 +445,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
end
end
return data_to_save
end
--[========[Game Interface Control]========]
@ -589,7 +590,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
wesnoth.select_unit = wesnoth.deprecate_api('wesnoth.select_unit', 'wesnoth.interface.select_unit', 1, nil, wesnoth.interface.select_unit)
wesnoth.highlight_hex = wesnoth.deprecate_api('wesnoth.highlight_hex', 'wesnoth.interface.highlight_hex', 1, nil, wesnoth.interface.highlight_hex)
wesnoth.deselect_hex = wesnoth.deprecate_api('wesnoth.deselect_hex', 'wesnoth.interface.deselect_hex', 1, nil, wesnoth.interface.deselect_hex)
wesnoth.get_selected_tile = wesnoth.deprecate_api('wesnoth.get_selected_tile', 'wesnoth.interface.get_selected_hex', 1, nil, wesnoth.interface.get_selected_)
wesnoth.get_selected_tile = wesnoth.deprecate_api('wesnoth.get_selected_tile', 'wesnoth.interface.get_selected_hex', 1, nil, wesnoth.interface.get_selected_hex)
wesnoth.scroll_to_tile = wesnoth.deprecate_api('wesnoth.scroll_to_tile', 'wesnot.interface.scroll_to_hex', 1, nil, wesnoth.interface.scroll_to_hex)
wesnoth.lock_view = wesnoth.deprecate_api('wesnoth.lock_view', 'wesnoth.interface.lock', 1, nil, wesnoth.interface.lock)
wesnoth.view_locked = wesnoth.deprecate_api('wesnoth.view_locked', 'wesnoth.interface.is_locked', 1, nil, wesnoth.interface.is_locked)

View file

@ -103,24 +103,24 @@ function wml_actions.store_items(cfg)
end
end
wesnoth.intf.remove_item = remove_overlay
wesnoth.interface.remove_item = remove_overlay
function wesnoth.intf.add_item_image(x, y, name)
function wesnoth.interface.add_item_image(x, y, name)
add_overlay(x, y, { x = x, y = y, image = name })
end
function wesnoth.intf.add_item_halo(x, y, name)
function wesnoth.interface.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)
remove = wesnoth.deprecate_api('items.remove', 'wesnoth.interface.remove_item', 1, nil, remove_overlay),
place_image = wesnoth.deprecate_api('items.place_image', 'wesnoth.interface.add_item_image', 1, nil, wesnoth.interface.add_item_image),
place_halo = wesnoth.deprecate_api('items.place_halo', 'wesnoth.interface.add_item_halo', 1, nil, wesnoth.interface.add_item_halo)
}
wesnoth.interface.remove_item = methods.remove
wesnoth.interface.add_item_image = methods.place_image
wesnoth.interface.add_item_halo = methods.place_halo
return methods