From 71f92aa05cd785e909114760eecfb49d8d49d368 Mon Sep 17 00:00:00 2001 From: mattsc Date: Thu, 14 Nov 2013 19:06:50 -0800 Subject: [PATCH] ai_helper.get_dst_src(units): minor code simplification --- data/ai/lua/ai_helper.lua | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/data/ai/lua/ai_helper.lua b/data/ai/lua/ai_helper.lua index e0117f38389..98aff3507f8 100644 --- a/data/ai/lua/ai_helper.lua +++ b/data/ai/lua/ai_helper.lua @@ -696,17 +696,13 @@ function ai_helper.get_dst_src_units(units, cfg) end function ai_helper.get_dst_src(units) - -- Produces the same output as ai.get_dst_src() (available in 1.11.0) - -- If units is given, use them, otherwise do it for all units on the current side + -- If 'units' table is given, use it, otherwise use all units on the current side - local my_units = {} - if units then - my_units = units - else - my_units = wesnoth.get_units { side = wesnoth.current.side } + if (not units) then + units = wesnoth.get_units { side = wesnoth.current.side } end - return ai_helper.get_dst_src_units(my_units) + return ai_helper.get_dst_src_units(units) end function ai_helper.get_enemy_dst_src(enemies)