[Lua] Fix missing parameter warning when passing empty filter

This commit is contained in:
Celtic Minstrel 2024-02-04 14:20:08 -05:00
parent 1efc2fbe4d
commit 1fd17d94ba
3 changed files with 7 additions and 7 deletions

View file

@ -1183,7 +1183,7 @@ function ai_helper.get_visible_units(viewing_side, filter)
table.insert(filter_plus_vision, wml.tag.filter_vision { side = viewing_side, visible = 'yes' })
local units = {}
local all_units = wesnoth.units.find_on_map()
local all_units = wesnoth.units.find_on_map{}
for _,unit in ipairs(all_units) do
if unit:matches(filter_plus_vision) then
table.insert(units, unit)
@ -1238,7 +1238,7 @@ function ai_helper.get_attackable_enemies(filter, side, cfg)
end
local enemies = {}
local all_units = wesnoth.units.find_on_map()
local all_units = wesnoth.units.find_on_map{}
for _,unit in ipairs(all_units) do
if wesnoth.sides.is_enemy(side, unit.side)
and (not unit.status.petrified)
@ -1746,7 +1746,7 @@ function ai_helper.find_path_with_shroud(unit, x, y, cfg)
if wesnoth.sides[viewing_side].shroud then
local extracted_units = {}
if (not cfg) or (not cfg.ignore_units) then
local all_units = wesnoth.units.find_on_map()
local all_units = wesnoth.units.find_on_map{}
for _,u in ipairs(all_units) do
if (u.id ~= unit.id) and (u.side ~= viewing_side)
and (not ignore_visibility) and (not ai_helper.is_visible_unit(viewing_side, u))
@ -1933,7 +1933,7 @@ function ai_helper.find_path_with_avoid(unit, x, y, avoid_map, options)
return nil, ai_helper.no_path
end
local all_units = wesnoth.units.find_on_map()
local all_units = wesnoth.units.find_on_map{}
local ally_map, enemy_map = LS.create(), LS.create()
for _,u in ipairs(all_units) do
if (u.id ~= unit.id) and ai_helper.is_visible_unit(wesnoth.current.side, u) then
@ -2175,7 +2175,7 @@ function ai_helper.get_attacks(units, cfg)
-- Note: the remainder is optimized for speed, so we only get_units once,
-- do not use WML filters, etc.
local all_units = wesnoth.units.find_on_map()
local all_units = wesnoth.units.find_on_map{}
local enemy_map, my_unit_map, other_unit_map = LS.create(), LS.create(), LS.create()
for i,unit in ipairs(all_units) do

View file

@ -9,7 +9,7 @@ local recruitedType
local recruitCost
local zombies = wml.array_access.get("zombies")
local sides = wesnoth.sides.find()
local sides = wesnoth.sides.find{}
local zombie_recruit_dialog = wml.load "campaigns/Secrets_of_the_Ancients/gui/zombie_recruit_dialog.cfg"

View file

@ -69,7 +69,7 @@ function wml_actions.chat(cfg)
local observable = cfg.observable ~= false
if observable then
local all_sides = wesnoth.sides.find()
local all_sides = wesnoth.sides.find{}
local has_human_side = false
for index, side in ipairs(all_sides) do
if side.controller == "human" and side.is_local then