Author: anonymissimus
Date: Sun Aug 21 19:39:11 2011
New Revision: 50873

URL: http://svn.gna.org/viewcvs/wesnoth?rev=50873&view=rev
Log:
improved [store_items] to store only items on locs matching given SLF

Modified:
    trunk/data/lua/wml/items.lua

Modified: trunk/data/lua/wml/items.lua
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/lua/wml/items.lua?rev=50873&r1=50872&r2=50873&view=diff
==============================================================================
--- trunk/data/lua/wml/items.lua (original)
+++ trunk/data/lua/wml/items.lua Sun Aug 21 19:39:11 2011
@@ -88,11 +88,16 @@
        variable = tostring(variable) or helper.wml_error("invalid variable= in 
[store_items]")
        wesnoth.set_variable(variable)
        local index = 0
-       for i,v in pairs(scenario_items) do
-               for j,w in ipairs(v) do
-                       wesnoth.set_variable(string.format("%s[%u]", variable, 
index), w)
-                       index = index + 1
-               end
+       for i, loc in ipairs(wesnoth.get_locations(cfg)) do
+               --ugly workaround for the lack of the "continue" statement in 
lua
+               repeat
+                       local items = scenario_items[loc[1] * 10000 + loc[2]]
+                       if not items then break end
+                       for j, item in ipairs(items) do
+                               wesnoth.set_variable(string.format("%s[%u]", 
variable, index), item)
+                               index = index + 1
+                       end
+               until true
        end
 end
 


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

Reply via email to