From 40c092f390640a53226b16cfd959f85e46d4c510 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sat, 13 Feb 2021 14:57:29 -0500 Subject: [PATCH] Missed some end_var_scope cases, plus typo --- data/lua/wml/find_path.lua | 15 ++++----------- data/lua/wml/harm_unit.lua | 4 +--- data/lua/wml/random_placement.lua | 3 --- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/data/lua/wml/find_path.lua b/data/lua/wml/find_path.lua index 2a94e0c0f649..30b31bcac468 100644 --- a/data/lua/wml/find_path.lua +++ b/data/lua/wml/find_path.lua @@ -116,17 +116,13 @@ function wesnoth.wml_actions.find_path(cfg) if cost >= 42424241 then -- it's the high value returned for unwalkable or busy terrains wml.variables[tostring(variable)] = { hexes = 0 } -- set only length, nil all other values - -- support for $this_unit - wml.variables["this_unit"] = nil -- clearing this_unit - utils.end_var_scope("this_unit", this_unit) - return end + return + end if not allow_multiple_turns and turns > 1 then -- location cannot be reached in one turn wml.variables[tostring(variable)] = { hexes = 0 } - -- support for $this_unit - wml.variables["this_unit"] = nil -- clearing this_unit - utils.end_var_scope("this_unit", this_unit) - return end -- skip the cycles below + return + end -- skip the cycles below wml.variables[tostring( variable )] = { @@ -165,7 +161,4 @@ function wesnoth.wml_actions.find_path(cfg) } end end - - -- support for $this_unit - wml.variables["this_unit"] = nil -- clearing this_unit end diff --git a/data/lua/wml/harm_unit.lua b/data/lua/wml/harm_unit.lua index f184cf6232bf..0a3207ad26f9 100644 --- a/data/lua/wml/harm_unit.lua +++ b/data/lua/wml/harm_unit.lua @@ -19,7 +19,7 @@ function wml_actions.harm_unit(cfg) else return false end end - local this_unit = utils.scoepd_var("this_unit") + local this_unit = utils.scoped_var("this_unit") for index, unit_to_harm in ipairs(wesnoth.units.find_on_map(filter)) do if unit_to_harm.valid then @@ -202,6 +202,4 @@ function wml_actions.harm_unit(cfg) wml_actions.redraw {} end - - wml.variables["this_unit"] = nil -- clearing this_unit end \ No newline at end of file diff --git a/data/lua/wml/random_placement.lua b/data/lua/wml/random_placement.lua index b95098250061..df42beea0dc9 100644 --- a/data/lua/wml/random_placement.lua +++ b/data/lua/wml/random_placement.lua @@ -87,11 +87,8 @@ wesnoth.wml_actions.random_placement = function(cfg) utils.set_exiting("none") break elseif action ~= "none" then - utils.end_var_scope(variable, variable_previous) return end end end - utils.end_var_scope(variable, variable_previous) - end