Protect Unit Micro AI: fix bug in goal selection

There was a typo in the goal table indexing.  It worked for the
multi-unit test scenario (the Elves Besieged) because the goal x
coordinates for both units were the same.
This commit is contained in:
mattsc 2014-04-16 08:02:39 -07:00
parent cce0dcba9d
commit 04bf7c56e0

View file

@ -51,7 +51,7 @@ function ca_protect_unit_move:execution(ai, cfg, self)
-- Also need the goal for this unit
local goal = {}
for i,id in ipairs(cfg.id) do
if (unit.id == id) then goal = { cfg.goal_x[1], cfg.goal_y[i] } end
if (unit.id == id) then goal = { cfg.goal_x[i], cfg.goal_y[i] } end
end
--print("Goal:",goal[1],goal[2])