Fix an issue with items and location sets

Fixes #4621
This commit is contained in:
Celtic Minstrel 2019-12-07 17:18:12 -05:00
parent e009989ec3
commit c366998021
2 changed files with 5 additions and 3 deletions

View file

@ -29,10 +29,12 @@ function locset_meta:__index(loc)
end
function locset_meta:__newindex(loc, val)
local fcn = methods.insert
if val == nil then fcn = methods.remove end
if loc.x and loc.y then
self:insert(loc.x, loc.y, val)
fcn(self, loc.x, loc.y, val)
else
self:insert(loc[1], loc[2], val)
fcn(self, loc[1], loc[2], val)
end
end

View file

@ -36,7 +36,7 @@ function wesnoth.interface.remove_item(x, y, name)
end
end
if not name or #items == 0 then
scenario_items:insert(x, y, nil)
scenario_items:remove(x, y)
end
end