Fast Micro AI: fix variable name

This wouldn't have been an issue, if there weren't also a local variable of the same name in the evaluation function. The way it was though, it caused an error when trying to execute an attack by the AI leader.
This commit is contained in:
mattsc 2021-01-18 19:29:55 -08:00
parent ee28ac0e26
commit 0905ee1fe7

View File

@ -3,7 +3,7 @@ local AH = wesnoth.require "ai/lua/ai_helper.lua"
local FAU = wesnoth.require "ai/micro_ais/cas/ca_fast_attack_utils.lua" local FAU = wesnoth.require "ai/micro_ais/cas/ca_fast_attack_utils.lua"
local LS = wesnoth.require "location_set" local LS = wesnoth.require "location_set"
local leader, fast_target, fast_dst local fast_leader, fast_target, fast_dst
local gamedata, move_cache local gamedata, move_cache
local ca_fast_combat_leader = {} local ca_fast_combat_leader = {}
@ -178,7 +178,7 @@ function ca_fast_combat_leader:evaluation(cfg, data)
end end
if best_target then if best_target then
leader = leader fast_leader = leader
fast_target, fast_dst = best_target, best_dst fast_target, fast_dst = best_target, best_dst
return cfg.ca_score return cfg.ca_score
end end
@ -188,8 +188,8 @@ function ca_fast_combat_leader:evaluation(cfg, data)
end end
function ca_fast_combat_leader:execution(cfg, data) function ca_fast_combat_leader:execution(cfg, data)
AH.robust_move_and_attack(ai, leader, fast_dst, fast_target) AH.robust_move_and_attack(ai, fast_leader, fast_dst, fast_target)
leader, fast_target, fast_dst = nil, nil, nil fast_leader, fast_target, fast_dst = nil, nil, nil
end end
return ca_fast_combat_leader return ca_fast_combat_leader