Patrol MAI: 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:55:30 -07:00
parent 0d4383c4ac
commit 493af0053b
2 changed files with 5 additions and 5 deletions

View file

@ -1,12 +1,12 @@
return {
init = function(ai)
local patrol = {}
local engine = {}
local H = wesnoth.require "lua/helper.lua"
local AH = wesnoth.require "ai/lua/ai_helper.lua"
function patrol:patrol_eval(cfg)
function engine:mai_patrol_eval(cfg)
local patrol = wesnoth.get_units({ id = cfg.id })[1]
-- Don't need to check if unit exists as this is a sticky CA
@ -14,7 +14,7 @@ return {
return 0
end
function patrol:patrol_exec(cfg)
function engine:mai_patrol_exec(cfg)
local patrol = wesnoth.get_units( { id = cfg.id } )[1]
cfg.waypoint_x = AH.split(cfg.waypoint_x, ",")
cfg.waypoint_y = AH.split(cfg.waypoint_y, ",")
@ -141,6 +141,6 @@ return {
if patrol and patrol.valid then ai.stopunit_all(patrol) end
end
return patrol
return engine
end
}

View file

@ -717,7 +717,7 @@ function wesnoth.wml_actions.micro_ai(cfg)
local unit = wesnoth.get_units { id=cfg_p.id }[1]
local CA_parms = {
{
id = "patrol_unit_" .. cfg_p.id, eval_name = 'patrol_eval', exec_name = 'patrol_exec',
id = "patrol_unit_" .. cfg_p.id, eval_name = 'mai_patrol_eval', exec_name = 'mai_patrol_exec',
max_score = 300000, sticky = true, unit_x = unit.x, unit_y = unit.y, cfg_table = cfg_p
},
}