Fixed [role] not working if type= was not specified
This commit is contained in:
parent
acdc67fe56
commit
650f21e582
1 changed files with 8 additions and 4 deletions
|
@ -1308,8 +1308,11 @@ function wml_actions.role(cfg)
|
|||
local filter = helper.shallow_literal(cfg)
|
||||
|
||||
local types = {}
|
||||
for value in utils.split(cfg.type) do
|
||||
table.insert(types, utils.trim(value))
|
||||
|
||||
if cfg.type then
|
||||
for value in utils.split(cfg.type) do
|
||||
table.insert(types, utils.trim(value))
|
||||
end
|
||||
end
|
||||
|
||||
filter.role, filter.type = nil, nil
|
||||
|
@ -1343,11 +1346,12 @@ function wml_actions.role(cfg)
|
|||
i = i + 1
|
||||
until #types == 0 or i > #types
|
||||
|
||||
-- no matching unit found, fail silently
|
||||
-- no matching unit found, issue a warning
|
||||
wesnoth.message("WML", "No matching units found in [role]")
|
||||
end
|
||||
|
||||
function wml_actions.unsynced(cfg)
|
||||
wesnoth.unsynced(function ()
|
||||
wml_actions.command(cfg)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue