Lua AIs: do not use empty tables as filters
It’s faster not to provide any argument to wesnoth.get_units() if all units are to be found.
This commit is contained in:
parent
984f8b196a
commit
d88bc01f62
2 changed files with 2 additions and 2 deletions
|
@ -1195,7 +1195,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.get_units {}
|
||||
local all_units = wesnoth.get_units()
|
||||
|
||||
local enemy_map, my_unit_map, other_unit_map = LS.create(), LS.create(), LS.create()
|
||||
for i,unit in ipairs(all_units) do
|
||||
|
|
|
@ -185,7 +185,7 @@ local function bottleneck_move_out_of_way(unit_in_way, self)
|
|||
|
||||
local reach = wesnoth.find_reach(unit_in_way)
|
||||
|
||||
local all_units = wesnoth.get_units { }
|
||||
local all_units = wesnoth.get_units()
|
||||
local occ_hexes = LS:create()
|
||||
for _,unit in ipairs(all_units) do
|
||||
occ_hexes:insert(unit.x, unit.y)
|
||||
|
|
Loading…
Add table
Reference in a new issue