Author: anonymissimus
Date: Wed Mar 16 19:04:38 2011
New Revision: 48924

URL: http://svn.gna.org/viewcvs/wesnoth?rev=48924&view=rev
Log:
[mofify_unit]: Disallow type= to be set only at the toplevel - the key could 
appear in [variables] and is valid there.

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=48924&r1=48923&r2=48924&view=diff
==============================================================================
--- trunk/data/lua/wml-tags.lua (original)
+++ trunk/data/lua/wml-tags.lua Wed Mar 16 19:04:38 2011
@@ -485,9 +485,9 @@
 function wml_actions.modify_unit(cfg)
        local unit_variable = "LUA_modify_unit"
 
-       local function handle_attributes(cfg, unit_path)
+       local function handle_attributes(cfg, unit_path, toplevel)
                for current_key, current_value in 
pairs(helper.shallow_parsed(cfg)) do
-                       if type(current_value) ~= "table" and current_key ~= 
"type" then
+                       if type(current_value) ~= "table" and (not toplevel or 
current_key ~= "type") then
                                wesnoth.set_variable(string.format("%s.%s", 
unit_path, current_key), current_value)
                        end
                end
@@ -512,7 +512,7 @@
                local children_handled = {}
                local unit_path = string.format("%s[%u]", unit_variable, 
unit_num)
                wesnoth.set_variable("this_unit", 
wesnoth.get_variable(unit_path))
-               handle_attributes(cfg, unit_path)
+               handle_attributes(cfg, unit_path, true)
 
                for current_index, current_table in 
ipairs(helper.shallow_parsed(cfg)) do
                        local current_tag = current_table[1]


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

Reply via email to