]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Pass ContentFeatures as reference to read_content_features (#10464)
authorJosiahWI <41302989+JosiahWI@users.noreply.github.com>
Tue, 13 Oct 2020 15:36:01 +0000 (10:36 -0500)
committerGitHub <noreply@github.com>
Tue, 13 Oct 2020 15:36:01 +0000 (16:36 +0100)
src/script/common/c_content.cpp
src/script/common/c_content.h
src/script/lua_api/l_item.cpp

index 147f6e3edb21b56f3d96fb3b5e4695c2d3a518b3..a95cf94a1ccdd666a3afc22de947084882cf4b43 100644 (file)
@@ -491,13 +491,11 @@ TileDef read_tiledef(lua_State *L, int index, u8 drawtype)
 }
 
 /******************************************************************************/
-ContentFeatures read_content_features(lua_State *L, int index)
+void read_content_features(lua_State *L, ContentFeatures &f, int index)
 {
        if(index < 0)
                index = lua_gettop(L) + 1 + index;
 
-       ContentFeatures f;
-
        /* Cache existence of some callbacks */
        lua_getfield(L, index, "on_construct");
        if(!lua_isnil(L, -1)) f.has_on_construct = true;
@@ -800,7 +798,6 @@ ContentFeatures read_content_features(lua_State *L, int index)
        getstringfield(L, index, "node_dig_prediction",
                f.node_dig_prediction);
 
-       return f;
 }
 
 void push_content_features(lua_State *L, const ContentFeatures &c)
index 8f32e58eb76060095aad9c16611c582c744caf0a..29d5763558bd62e75ae4f4b30ed2100c06a22002 100644 (file)
@@ -67,7 +67,8 @@ struct collisionMoveResult;
 
 extern struct EnumString es_TileAnimationType[];
 
-ContentFeatures    read_content_features     (lua_State *L, int index);
+void               read_content_features     (lua_State *L, ContentFeatures &f,
+                                              int index);
 void               push_content_features     (lua_State *L,
                                               const ContentFeatures &c);
 
index 2d1124a4d438edc382ffc6c3a30661cb6f6cb555..9e0da4034cb30322966f7febd77458152076cb32 100644 (file)
@@ -570,7 +570,8 @@ int ModApiItemMod::l_register_item_raw(lua_State *L)
 
        // Read the node definition (content features) and register it
        if (def.type == ITEM_NODE) {
-               ContentFeatures f = read_content_features(L, table);
+               ContentFeatures f;
+               read_content_features(L, f, table);
                // when a mod reregisters ignore, only texture changes and such should
                // be done
                if (f.name == "ignore")