mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-22 19:36:04 +00:00
ai_helper: fix visibility bug in get_attackable_enemies()
The passed filter needs to be enclosed in an [and] tag, otherwise the check for visibility might not work correctly, for example if the filter contains a top level [or] tag.
This commit is contained in:
parent
8711af07ca
commit
768b930fc4
@ -1200,7 +1200,10 @@ function ai_helper.get_attackable_enemies(filter, side, cfg)
|
||||
local filter_plus_vision = {}
|
||||
if filter then filter_plus_vision = ai_helper.table_copy(filter) end
|
||||
if (not ignore_visibility) then
|
||||
table.insert(filter_plus_vision, { "filter_vision", { side = viewing_side, visible = 'yes' } })
|
||||
filter_plus_vision = {
|
||||
{ "and", filter_plus_vision },
|
||||
{ "filter_vision", { side = viewing_side, visible = 'yes' } }
|
||||
}
|
||||
end
|
||||
|
||||
local enemies = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user