[allow_recruit], [disallow_recruit]: added a less cryptic error message if type= is missing
This commit is contained in:
parent
a72d1faca5
commit
095b7b772f
1 changed files with 4 additions and 2 deletions
|
@ -128,9 +128,10 @@ function wml_actions.fire_event(cfg)
|
|||
end
|
||||
|
||||
function wml_actions.allow_recruit(cfg)
|
||||
local unit_types = cfg.type or helper.wml_error("[allow_recruit] missing required type= attribute")
|
||||
for index, team in ipairs(wesnoth.get_sides(cfg)) do
|
||||
local v = team.recruit
|
||||
for type in string.gmatch(cfg.type, "[^%s,][^,]*") do
|
||||
for type in string.gmatch(unit_types, "[^%s,][^,]*") do
|
||||
table.insert(v, type)
|
||||
wesnoth.add_known_unit(type)
|
||||
end
|
||||
|
@ -151,9 +152,10 @@ function wml_actions.allow_extra_recruit(cfg)
|
|||
end
|
||||
|
||||
function wml_actions.disallow_recruit(cfg)
|
||||
local unit_types = cfg.type or helper.wml_error("[disallow_recruit] missing required type= attribute")
|
||||
for index, team in ipairs(wesnoth.get_sides(cfg)) do
|
||||
local v = team.recruit
|
||||
for w in string.gmatch(cfg.type, "[^%s,][^,]*") do
|
||||
for w in string.gmatch(unit_types, "[^%s,][^,]*") do
|
||||
for i, r in ipairs(v) do
|
||||
if r == w then
|
||||
table.remove(v, i)
|
||||
|
|
Loading…
Add table
Reference in a new issue