Fixed [store_unit]mode=replace clearing the variable...

...even if no units are found. Array entries are cleared as far as
neccessary now (if the array was longer those entries remain).
This commit is contained in:
Anonymissimus 2010-12-17 22:12:01 +00:00
parent 59c475d4d8
commit 7a73632541

View file

@ -336,12 +336,13 @@ function wml_actions.store_unit(cfg)
local filter = helper.get_child(cfg, "filter") or
helper.wml_error "[store_unit] missing required [filter] tag"
local kill_units = cfg.kill
local mode = cfg.mode
local var = cfg.variable or "unit"
local idx = 0
if cfg.mode == "append" then
if mode == "append" then
idx = wesnoth.get_variable(var .. ".length")
else
elseif mode ~= "replace" then
wesnoth.set_variable(var)
end