Author: anonymissimus
Date: Wed Mar 16 01:56:36 2011
New Revision: 48922

URL: http://svn.gna.org/viewcvs/wesnoth?rev=48922&view=rev
Log:
Optimization of previous commit.

Modified:
    trunk/data/lua/wml-tags.lua

Modified: trunk/data/lua/wml-tags.lua
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/lua/wml-tags.lua?rev=48922&r1=48921&r2=48922&view=diff
==============================================================================
--- trunk/data/lua/wml-tags.lua (original)
+++ trunk/data/lua/wml-tags.lua Wed Mar 16 01:56:36 2011
@@ -495,9 +495,10 @@
 
        local function handle_child(cfg, unit_path)
                local children_handled = {}
+               local cfg = helper.shallow_parsed(cfg)
                handle_attributes(cfg, unit_path)
 
-               for current_index, current_table in 
ipairs(helper.shallow_parsed(cfg)) do
+               for current_index, current_table in ipairs(cfg) do
                        local current_tag = current_table[1]
                        local tag_index = children_handled[current_tag] or 0
                        handle_child(current_table[2], 
string.format("%s.%s[%u]",
@@ -507,7 +508,6 @@
        end
 
        local filter = helper.get_child(cfg, "filter") or helper.wml_error 
"[modify_unit] missing required [filter] tag"
-       local type = cfg.type
        local function handle_unit(unit_num)
                local children_handled = {}
                local unit_path = string.format("%s[%u]", unit_variable, 
unit_num)
@@ -532,8 +532,8 @@
                        end
                end
 
-               if type then
-                       if type ~= "" then wesnoth.set_variable(unit_path .. 
".advances_to", type) end
+               if cfg.type then
+                       if cfg.type ~= "" then wesnoth.set_variable(unit_path 
.. ".advances_to", cfg.type) end
                        wesnoth.set_variable(unit_path .. ".experience", 
wesnoth.get_variable(unit_path .. ".max_experience"))
                end
                wml_actions.unstore_unit { variable = unit_path }


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to