Skip to content

Commit 11f3deb

Browse files
authoredOct 13, 2020
Pass ContentFeatures as reference to read_content_features (#10464)
1 parent d671102 commit 11f3deb

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed
 

Diff for: ‎src/script/common/c_content.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,11 @@ TileDef read_tiledef(lua_State *L, int index, u8 drawtype)
491491
}
492492

493493
/******************************************************************************/
494-
ContentFeatures read_content_features(lua_State *L, int index)
494+
void read_content_features(lua_State *L, ContentFeatures &f, int index)
495495
{
496496
if(index < 0)
497497
index = lua_gettop(L) + 1 + index;
498498

499-
ContentFeatures f;
500-
501499
/* Cache existence of some callbacks */
502500
lua_getfield(L, index, "on_construct");
503501
if(!lua_isnil(L, -1)) f.has_on_construct = true;
@@ -800,7 +798,6 @@ ContentFeatures read_content_features(lua_State *L, int index)
800798
getstringfield(L, index, "node_dig_prediction",
801799
f.node_dig_prediction);
802800

803-
return f;
804801
}
805802

806803
void push_content_features(lua_State *L, const ContentFeatures &c)

Diff for: ‎src/script/common/c_content.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ struct collisionMoveResult;
6767

6868
extern struct EnumString es_TileAnimationType[];
6969

70-
ContentFeatures read_content_features (lua_State *L, int index);
70+
void read_content_features (lua_State *L, ContentFeatures &f,
71+
int index);
7172
void push_content_features (lua_State *L,
7273
const ContentFeatures &c);
7374

Diff for: ‎src/script/lua_api/l_item.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,8 @@ int ModApiItemMod::l_register_item_raw(lua_State *L)
570570

571571
// Read the node definition (content features) and register it
572572
if (def.type == ITEM_NODE) {
573-
ContentFeatures f = read_content_features(L, table);
573+
ContentFeatures f;
574+
read_content_features(L, f, table);
574575
// when a mod reregisters ignore, only texture changes and such should
575576
// be done
576577
if (f.name == "ignore")

0 commit comments

Comments
 (0)
Please sign in to comment.