From 8aa930f28e69f3518831500022988ca2a4b6985d Mon Sep 17 00:00:00 2001 From: kwolekr Date: Wed, 26 Jun 2013 17:19:39 -0400 Subject: Add minetest.get_mapgen_object to API --- src/script/lua_api/l_vmanip.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/script/lua_api/l_vmanip.cpp') diff --git a/src/script/lua_api/l_vmanip.cpp b/src/script/lua_api/l_vmanip.cpp index e0397dfce..6743f40f9 100644 --- a/src/script/lua_api/l_vmanip.cpp +++ b/src/script/lua_api/l_vmanip.cpp @@ -33,7 +33,8 @@ with this program; if not, write to the Free Software Foundation, Inc., int LuaVoxelManip::gc_object(lua_State *L) { LuaVoxelManip *o = *(LuaVoxelManip **)(lua_touserdata(L, 1)); - delete o; + if (o->do_gc) + delete o; return 0; } @@ -82,7 +83,6 @@ int LuaVoxelManip::l_write_chunk(lua_State *L) vm->m_data[i].setContent(c); lua_pop(L, 1); - } vm->blitBackAll(&o->modified_blocks); @@ -184,6 +184,12 @@ int LuaVoxelManip::l_update_map(lua_State *L) return 0; } +LuaVoxelManip::LuaVoxelManip(ManualMapVoxelManipulator *mmvm, bool dogc) +{ + this->vm = mmvm; + this->do_gc = dogc; +} + LuaVoxelManip::LuaVoxelManip(Map *map) { vm = new ManualMapVoxelManipulator(map); -- cgit v1.2.3