Skip to content

Commit

Permalink
Micro AIs: issue warning if side defined in [micro_ai] tag does not e…
Browse files Browse the repository at this point in the history
…xist

Previously this would cause a whole series of Lua error messages and,
potentially, some code not being executed.
  • Loading branch information
mattsc authored and mattsc committed May 20, 2015
1 parent b6be3ac commit 86b0433
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions data/ai/micro_ais/micro_ai_wml_tag.lua
Expand Up @@ -50,6 +50,10 @@ function wesnoth.wml_actions.micro_ai(cfg)
-- Check that the required common keys are all present and set correctly
if (not cfg.ai_type) then H.wml_error("[micro_ai] is missing required ai_type= key") end
if (not cfg.side) then H.wml_error("[micro_ai] is missing required side= key") end
if (not wesnoth.sides[cfg.side]) then
wesnoth.message("Warning", "[micro_ai] uses side=" .. cfg.side .. ": side does not exist")
return
end
if (not cfg.action) then H.wml_error("[micro_ai] is missing required action= key") end

if (cfg.action ~= 'add') and (cfg.action ~= 'delete') and (cfg.action ~= 'change') then
Expand Down

0 comments on commit 86b0433

Please sign in to comment.