]> git.lizzy.rs Git - minetest.git/commitdiff
Schematics: Fix minetest.place_schematic() when defined by a Lua table
authorkwolekr <kwolekr@minetest.net>
Sat, 6 Dec 2014 23:39:05 +0000 (18:39 -0500)
committerkwolekr <kwolekr@minetest.net>
Sat, 6 Dec 2014 23:39:05 +0000 (18:39 -0500)
src/mg_schematic.cpp
src/script/common/c_content.cpp

index 92cbf8e4eff1741e51c4f8f1dfbeeafcff434ade..d203a7105b45975e77b0a6826c5f91e4ee420ddb 100644 (file)
@@ -57,7 +57,7 @@ void Schematic::updateContentIds()
 
        flags |= SCHEM_CIDS_UPDATED;
 
-       for (int i = 0; i != size.X * size.Y * size.Z; i++)
+       for (size_t i = 0; i != size.X * size.Y * size.Z; i++)
                schemdata[i].setContent(c_nodes[schemdata[i].getContent()]);
 }
 
index bf4da41eccccf1746a5545284b6e1c3a7d404839..799251bcfe7514df68387713645c88cce7130ea3 100644 (file)
@@ -267,7 +267,7 @@ ContentFeatures read_content_features(lua_State *L, int index)
        lua_getfield(L, index, "on_rightclick");
        f.rightclickable = lua_isfunction(L, -1);
        lua_pop(L, 1);
-       
+
        /* Name */
        getstringfield(L, index, "name", f.name);
 
@@ -1039,7 +1039,7 @@ bool read_schematic(lua_State *L, int index, Schematic *schem,
        //// Get schematic data
        lua_getfield(L, index, "data");
        luaL_checktype(L, -1, LUA_TTABLE);
-       
+
        int numnodes = size.X * size.Y * size.Z;
        MapNode *schemdata = new MapNode[numnodes];
        int i = 0;
@@ -1069,7 +1069,7 @@ bool read_schematic(lua_State *L, int index, Schematic *schem,
 
                        schemdata[i] = MapNode(ndef, name, param1, param2);
                }
-               
+
                i++;
                lua_pop(L, 1);
        }
@@ -1098,7 +1098,10 @@ bool read_schematic(lua_State *L, int index, Schematic *schem,
                }
        }
 
-       schem->flags       = 0;
+       // Here, we read the nodes directly from the INodeDefManager - there is no
+       // need for pending node resolutions so we'll mark this schematic as updated
+       schem->flags       = SCHEM_CIDS_UPDATED;
+
        schem->size        = size;
        schem->schemdata   = schemdata;
        schem->slice_probs = slice_probs;