Skip to content

Commit

Permalink
Allow [disallow_recruit] to disable the whole recruit list of a side …
Browse files Browse the repository at this point in the history
…if passed without type=
  • Loading branch information
Vultraz committed Jan 25, 2015
1 parent e722c64 commit b297831
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions data/lua/wml-tags.lua
Expand Up @@ -196,18 +196,22 @@ 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")
local unit_types = cfg.type
for index, team in ipairs(wesnoth.get_sides(cfg)) do
local v = team.recruit
for w in split(unit_types) do
for i, r in ipairs(v) do
if r == w then
table.remove(v, i)
break
if unit_types then
local v = team.recruit
for w in split(unit_types) do
for i, r in ipairs(v) do
if r == w then
table.remove(v, i)
break
end
end
end
team.recruit = v
else
team.recruit = nil
end
team.recruit = v
end
end

Expand Down

0 comments on commit b297831

Please sign in to comment.