Skip to content

Commit

Permalink
Fast Micro AI ai_helper functions: fix rarely occurring bug
Browse files Browse the repository at this point in the history
When the AI moves a unit out of the way for another unit’s move, it is
occasionally possible for the former unit to use up all its movement
points (e.g. if it has few MP or on narrow crowded maps). If that unit
is on the list to be moved later during the same sequence, this caused
ai_helper.robust_move_and_attack() to return nil, which then made the
Fast Micro AI produce an error message.
  • Loading branch information
mattsc authored and GregoryLundberg committed Nov 30, 2017
1 parent b9d0306 commit 671f4d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion data/ai/lua/ai_helper.lua
Expand Up @@ -329,7 +329,7 @@ function ai_helper.robust_move_and_attack(ai, src, dst, target_loc, cfg)
end

local gamestate_changed = false
local move_result
local move_result = ai_helper.dummy_check_action(false, false, 'robust_move_and_attack::NO_ACTION')
if (unit.moves > 0) then
if (src_x == dst_x) and (src_y == dst_y) then
move_result = ai.stopunit_moves(unit)
Expand Down

0 comments on commit 671f4d0

Please sign in to comment.