[micro_ai] tag: make ca_score a universal optional key for all Micro AIs

This does not mean that all the MAIs do anything with this yet, only
that it is passed to all MAIs for which it is set.  It needs to be
implemented on a one-by-one basis.  Only the Goto MAI uses this option
so far.
This commit is contained in:
mattsc 2013-07-02 16:57:11 -07:00
parent ec11244c1e
commit 3059a11602

View file

@ -590,7 +590,7 @@ function wesnoth.wml_actions.micro_ai(cfg)
--------- Goto Micro AI - side-wide AI ------------------------------------
elseif (cfg.ai_type == 'goto') then
required_keys = { "filter", "filter_location" }
optional_keys = { "ca_score", "release_all_units_at_goal", "release_unit_at_goal", "unique_goals", "use_straight_line" }
optional_keys = { "release_all_units_at_goal", "release_unit_at_goal", "unique_goals", "use_straight_line" }
CA_parms = {
{ -- Note: do not define max_score
ca_id = 'goto', eval_name = 'mai_goto_eval', exec_name = 'mai_goto_exec'
@ -638,6 +638,9 @@ function wesnoth.wml_actions.micro_ai(cfg)
if child then CA_cfg[v] = child end
end
-- Universal optional keys
CA_cfg.ca_score = cfg.ca_score
-- Finally, set up the candidate actions themselves
if (cfg.action == 'add') then add_CAs(cfg.side, CA_parms, CA_cfg) end
if (cfg.action == 'change') then