Author: mattsc Date: Mon Mar 4 22:27:15 2013 New Revision: 56451 URL: http://svn.gna.org/viewcvs/wesnoth?rev=56451&view=rev Log: Priority Target Micro AI: convert a variable to boolean
target_in_reach is only used to determine whether any target is in reach, the count of targets is meaningless. Thanks shadowm. Modified: trunk/data/ai/micro_ais/ais/priority_target_engine.lua Modified: trunk/data/ai/micro_ais/ais/priority_target_engine.lua URL: http://svn.gna.org/viewcvs/wesnoth/trunk/data/ai/micro_ais/ais/priority_target_engine.lua?rev=56451&r1=56450&r2=56451&view=diff ============================================================================== --- trunk/data/ai/micro_ais/ais/priority_target_engine.lua (original) +++ trunk/data/ai/micro_ais/ais/priority_target_engine.lua Mon Mar 4 22:27:15 2013 @@ -16,7 +16,7 @@ --print("\nAttackers:",#attackers) -- This gets set to >0 if unit that can attack target is found - local target_in_reach = 0 + local target_in_reach -- See if any of those units can reach our target(s) for i,u in ipairs(attackers) do @@ -42,7 +42,7 @@ --print("reachable locs:",u.id,#tir) -- If unit can reach a target -> set variable to 1 - if (#tir > 0) then target_in_reach = 1 end + if (#tir > 0) then target_in_reach = true end end -- Always delete the attacks aspect first, so that we do not end up with 100 copies of the facet @@ -66,7 +66,7 @@ } -- If the target is in reach, set the 'attacks' aspect accordingly ... - if (target_in_reach > 0) then + if target_in_reach then --print("Setting attacks aspect") W.modify_ai { side = wesnoth.current.side, _______________________________________________ Wesnoth-commits mailing list Wesnoth-commits@gna.org https://mail.gna.org/listinfo/wesnoth-commits