From b657bbc862e6ef721c5c13f0da62acb303105a3f Mon Sep 17 00:00:00 2001 From: mattsc Date: Thu, 2 Apr 2015 08:07:21 -0700 Subject: [PATCH] Forest Animals MAI: bug fix, exclude border hexes for wander terrain 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. --- data/ai/micro_ais/cas/ca_forest_animals_move.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/data/ai/micro_ais/cas/ca_forest_animals_move.lua b/data/ai/micro_ais/cas/ca_forest_animals_move.lua index 22bd280856f..11e72a9ea78 100644 --- a/data/ai/micro_ais/cas/ca_forest_animals_move.lua +++ b/data/ai/micro_ais/cas/ca_forest_animals_move.lua @@ -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 = {}