Goto MAI: fix bug causing errors for unreachable goal hexes

This includes hexes occupied by an enemy unit.
This commit is contained in:
mattsc 2014-08-11 18:56:05 -07:00
parent 20370a99b8
commit 607f91a473

View file

@ -200,7 +200,12 @@ function ca_goto:execution(ai, cfg, self)
end
end
AH.checked_move_full(ai, best_unit, closest_hex[1], closest_hex[2])
if closest_hex then
AH.checked_move_full(ai, best_unit, closest_hex[1], closest_hex[2])
else
AH.checked_stopunit_moves(ai, best_unit)
end
if (not best_unit) or (not best_unit.valid) then return end
-- If release_unit_at_goal= or release_all_units_at_goal= key is set: