Skip to content

Commit

Permalink
Missed some end_var_scope cases, plus typo
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Feb 13, 2021
1 parent 3c44e28 commit 40c092f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
15 changes: 4 additions & 11 deletions data/lua/wml/find_path.lua
Expand Up @@ -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 )] =
{
Expand Down Expand Up @@ -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
4 changes: 1 addition & 3 deletions data/lua/wml/harm_unit.lua
Expand Up @@ -19,7 +19,7 @@ function wml_actions.harm_unit(cfg)
else return false end
end

local this_unit <close> = utils.scoepd_var("this_unit")
local this_unit <close> = 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
Expand Down Expand Up @@ -202,6 +202,4 @@ function wml_actions.harm_unit(cfg)

wml_actions.redraw {}
end

wml.variables["this_unit"] = nil -- clearing this_unit
end
3 changes: 0 additions & 3 deletions data/lua/wml/random_placement.lua
Expand Up @@ -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

0 comments on commit 40c092f

Please sign in to comment.