Implement shroud API deprecation wrappers that handle shroud data strings

Addresses #5885
This commit is contained in:
Celtic Minstrel 2021-06-23 09:55:12 -04:00
parent 10b59c99d0
commit 16157e286b

View file

@ -29,6 +29,23 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
if type(side) == 'number' then side = wesnoth.sides[side] end
return side.starting_location
end
local function place_shroud(side, shroud)
if type(shroud) == 'string' then
shroud = wesnoth.map.parse_bitmap(shroud)
end
wesnoth.sides.place_shroud(side, shroud)
end
local function remove_shroud(side, shroud)
if type(shroud) == 'string' then
if shroud == 'all' then
wesnoth.sides.override_shroud(side, {})
return
end
shroud = wesnoth.map.parse_bitmap(shroud)
end
wesnoth.sides.remove_shroud(side, shroud)
end
wesnoth.get_side_variable = wesnoth.deprecate_api('wesnoth.get_side_variable', 'wesnoth.sides[].variables', 1, nil, wesnoth.get_side_variable)
wesnoth.set_side_variable = wesnoth.deprecate_api('wesnoth.set_side_variable', 'wesnoth.sides[].variables', 1, nil, wesnoth.set_side_variable)
@ -45,8 +62,8 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
wesnoth.get_sides = wesnoth.deprecate_api('wesnoth.get_sides', 'wesnoth.sides.find', 1, nil, wesnoth.sides.find)
wesnoth.create_side = wesnoth.deprecate_api('wesnoth.create_side', 'wesnoth.sides.create', 1, nil, wesnoth.sides.create)
wesnoth.modify_ai = wesnoth.deprecate_api('wesnoth.modify_ai', 'wesnoth.sides.add|delete|change_ai_component', 1, nil, wesnoth.modify_ai)
wesnoth.place_shroud = wesnoth.deprecate_api('wesnoth.place_shroud', 'wesnoth.sides.place_shroud or wesnoth.sides.override_shroud', 1, nil, wesnoth.sides.place_shroud)
wesnoth.remove_shroud = wesnoth.deprecate_api('wesnoth.remove_shroud', 'wesnoth.sides.remove_shroud', 1, nil, wesnoth.sides.remove_shroud)
wesnoth.place_shroud = wesnoth.deprecate_api('wesnoth.place_shroud', 'wesnoth.sides.place_shroud or wesnoth.sides.override_shroud', 1, nil, place_shroud)
wesnoth.remove_shroud = wesnoth.deprecate_api('wesnoth.remove_shroud', 'wesnoth.sides.remove_shroud', 1, nil, remove_shroud)
wesnoth.is_shrouded = wesnoth.deprecate_api('wesnoth.is_shrouded', 'wesnoth.sides.is_shrouded', 1, nil, wesnoth.sides.is_shrouded)
wesnoth.add_fog = wesnoth.deprecate_api('wesnoth.add_fog', 'wesnoth.sides.place_fog', 1, nil, wesnoth.sides.place_fog)
wesnoth.remove_fog = wesnoth.deprecate_api('wesnoth.remove_fog', 'wesnoth.sides.remove_fog', 1, nil, wesnoth.sides.remove_fog)