Recruit MAIs: rename internal engine functions

No change of functionality.  This is done to ensure that function names
are unique, a necessary step toward making different MAIs combinable.
This commit is contained in:
mattsc 2013-06-26 14:32:15 -07:00
parent e4bdb188e7
commit 778ab615d1
2 changed files with 10 additions and 10 deletions

View file

@ -3,25 +3,25 @@ return {
local AH = wesnoth.require("ai/lua/ai_helper.lua")
local recruit_cas = {}
local engine = {}
local internal_recruit_cas = {}
local internal_params = {}
-- The following external engine creates the CA functions recruit_rushers_eval and recruit_rushers_exec
-- It also exposes find_best_recruit and find_best_recruit_hex for use by other recruit engines
wesnoth.require("ai/lua/generic-recruit_engine.lua").init(ai, internal_recruit_cas, internal_params)
function recruit_cas:rusher_recruit_eval(cfg)
function engine:mai_rusher_recruit_eval(cfg)
internal_params.randomness = cfg.randomness
return internal_recruit_cas:recruit_rushers_eval()
end
function recruit_cas:rusher_recruit_exec(cfg)
function engine:mai_rusher_recruit_exec(cfg)
return internal_recruit_cas:recruit_rushers_exec()
end
local recruit
function recruit_cas:random_recruit_eval(cfg)
function engine:mai_random_recruit_eval(cfg)
-- Random recruiting from all the units the side has
-- Check if leader is on keep
@ -117,13 +117,13 @@ return {
return 180000
end
function recruit_cas:random_recruit_exec()
function engine:mai_random_recruit_exec()
-- Let this function blacklist itself if the chosen recruit is too expensive
if wesnoth.unit_types[recruit].cost <= wesnoth.sides[wesnoth.current.side].gold then
ai.recruit(recruit)
end
end
return recruit_cas
return engine
end
}

View file

@ -736,13 +736,13 @@ function wesnoth.wml_actions.micro_ai(cfg)
if cfg.recruiting_type then
if cfg.recruiting_type == "rushers" then
recruit_CA.eval_name = 'rusher_recruit_eval'
recruit_CA.exec_name = 'rusher_recruit_exec'
recruit_CA.eval_name = 'mai_rusher_recruit_eval'
recruit_CA.exec_name = 'mai_rusher_recruit_exec'
cfg_recruiting.randomness = cfg.randomness
elseif cfg.recruiting_type == "random" then
recruit_CA.eval_name = 'random_recruit_eval'
recruit_CA.exec_name = 'random_recruit_exec'
recruit_CA.eval_name = 'mai_random_recruit_eval'
recruit_CA.exec_name = 'mai_random_recruit_exec'
cfg_recruiting.skip_low_gold_recruiting = cfg.skip_low_gold_recruiting