From 38091cb48a197e3138bedaa70341302fa8e19f33 Mon Sep 17 00:00:00 2001 From: Anonymissimus Date: Sun, 14 Aug 2011 00:24:42 +0000 Subject: [PATCH] add SLF support to [event][item] --- data/lua/wml/items.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/data/lua/wml/items.lua b/data/lua/wml/items.lua index 507e9a02f09..62e185d258a 100644 --- a/data/lua/wml/items.lua +++ b/data/lua/wml/items.lua @@ -11,7 +11,7 @@ local function add_overlay(x, y, cfg) items = {} scenario_items[x * 10000 + y] = items end - table.insert(items, cfg) + table.insert(items, { x = x, y = y, image = cfg.image, halo = cfg.halo, team_name = cfg.team_name, visible_in_fog = cfg.visible_in_fog }) end local function remove_overlay(x, y, name) @@ -59,15 +59,14 @@ function game_events.on_load(cfg) end function wml_actions.item(cfg) + local locs = wesnoth.get_locations(cfg) cfg = helper.parsed(cfg) if not cfg.image and not cfg.halo then helper.wml_error "[item] missing required image= and halo= attributes." end - local x, y = tonumber(cfg.x), tonumber(cfg.y) - if not x or not y then - helper.wml_error "[item] missing required x= and y= attributes." + for i, loc in ipairs(locs) do + add_overlay(loc[1], loc[2], cfg) end - add_overlay(x, y, cfg) wml_actions.redraw {} end