Skip to content

Commit

Permalink
Fast Micro AI: fix variable name
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mattsc committed Jan 19, 2021
1 parent ee28ac0 commit 0905ee1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions data/ai/micro_ais/cas/ca_fast_combat_leader.lua
Expand Up @@ -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 LS = wesnoth.require "location_set"

local leader, fast_target, fast_dst
local fast_leader, fast_target, fast_dst
local gamedata, move_cache

local ca_fast_combat_leader = {}
Expand Down Expand Up @@ -178,7 +178,7 @@ function ca_fast_combat_leader:evaluation(cfg, data)
end

if best_target then
leader = leader
fast_leader = leader
fast_target, fast_dst = best_target, best_dst
return cfg.ca_score
end
Expand All @@ -188,8 +188,8 @@ function ca_fast_combat_leader:evaluation(cfg, data)
end

function ca_fast_combat_leader:execution(cfg, data)
AH.robust_move_and_attack(ai, leader, fast_dst, fast_target)
leader, fast_target, fast_dst = nil, nil, nil
AH.robust_move_and_attack(ai, fast_leader, fast_dst, fast_target)
fast_leader, fast_target, fast_dst = nil, nil, nil
end

return ca_fast_combat_leader

0 comments on commit 0905ee1

Please sign in to comment.