Fix the previous commit
authorPerttu Ahola <celeron55@gmail.com>
Fri, 2 Dec 2011 00:04:25 +0000 (02:04 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Fri, 2 Dec 2011 00:04:25 +0000 (02:04 +0200)
src/scriptapi.cpp

index 359c1448299cdc3f2b6c7e0fa06acacbb4bf5cd9..951ff6f83b89eda8e6ebbd5e6674493c78d1d501 100644 (file)
@@ -420,7 +420,8 @@ static void inventory_set_list_from_lua(Inventory *inv, const char *name,
                // removes value, keeps key for next iteration
                lua_pop(L, 1);
        }
-       InventoryList *invlist = inv->addList(name, items.size());
+       int listsize = (forcesize != -1) ? forcesize : items.size();
+       InventoryList *invlist = inv->addList(name, listsize);
        int index = 0;
        for(std::list<std::string>::const_iterator
                        i = items.begin(); i != items.end(); i++){