Skip to content

Commit

Permalink
Forest Animals MAI: bug fix, exclude border hexes for wander terrain
Browse files Browse the repository at this point in the history
wesnoth.get_locations includes border hexes, so they need to be
excluded specifically. Previously this could cause error messages and
the CA to be blacklisted.
  • Loading branch information
mattsc authored and mattsc committed Apr 2, 2015
1 parent 5ca881b commit 34d6e53
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion data/ai/micro_ais/cas/ca_forest_animals_move.lua
Expand Up @@ -76,7 +76,12 @@ function ca_forest_animals_move:execution(ai, cfg)
local wander_terrain = cfg.filter_location or {}
if (not close_enemies[1]) then
local reach = AH.get_reachable_unocc(unit)
local wander_locs = wesnoth.get_locations(wander_terrain)
local width, height = wesnoth.get_map_size()
local wander_locs = wesnoth.get_locations {
x = '1-' .. width,
y = '1-' .. height,
{ "and", wander_terrain }
}
local locs_map = LS.of_pairs(wander_locs)

local reachable_wander_terrain = {}
Expand Down

0 comments on commit 34d6e53

Please sign in to comment.