Lua API: Fix the deprecation wrappers for place_shroud and remove_shroud

- The "all" special case moved to place_shroud, as it should be
- Shroud data string handling fixed

Fixes #5885
This commit is contained in:
Celtic Minstrel 2021-07-25 15:22:28 -04:00 committed by Celtic Minstrel
parent 0801061ee2
commit cda910854e

View file

@ -32,17 +32,28 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then
local function place_shroud(side, shroud)
if type(shroud) == 'string' then
shroud = wesnoth.map.parse_bitmap(shroud)
if shroud == 'all' then
wesnoth.sides.override_shroud(side, {})
else
local ls = wesnoth.require "location_set"
local clear = ls.of_shroud_data(shroud)
shroud = ls.create()
for x,y in wesnoth.current.map:iter() do
if not clear(x,y) then
shroud:insert(x,y)
end
end
wesnoth.sides.place_shroud(side, shroud:to_pairs())
end
else
wesnoth.sides.place_shroud(side, 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)
-- This may look wrong, but it's replicating the (undocumented) behaviour in 1.14
wesnoth.place_shroud(side, shroud)
return
end
wesnoth.sides.remove_shroud(side, shroud)
end