don't use __shallow_literal directly

the passed config might not be a vconfig.
This commit is contained in:
gfgtdf 2015-12-21 20:33:16 +01:00
parent 1eefcddc17
commit 4c955e7461

View File

@ -933,7 +933,7 @@ end
function wml_actions.harm_unit(cfg)
local filter = helper.get_child(cfg, "filter") or helper.wml_error("[harm_unit] missing required [filter] tag")
-- we need to use shallow_literal field, to avoid raising an error if $this_unit (not yet assigned) is used
if not cfg.__shallow_literal.amount then helper.wml_error("[harm_unit] has missing required amount= attribute") end
if not helper.shallow_literal(cfg).amount then helper.wml_error("[harm_unit] has missing required amount= attribute") end
local variable = cfg.variable -- kept out of the way to avoid problems
local _ = wesnoth.textdomain "wesnoth"
-- #textdomain wesnoth