summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_vmanip.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2014-12-29 01:31:37 -0500
committerkwolekr <kwolekr@minetest.net>2014-12-29 01:31:37 -0500
commitcc3ab5efa527884e40cfc8e44692ed892d3480b3 (patch)
tree88403c7e4df7d842f5279b6916a6da1a70c01a79 /src/script/lua_api/l_vmanip.cpp
parent3c637b4bafcef7b90c98a8d656d300ccd8d37eac (diff)
downloadminetest-cc3ab5efa527884e40cfc8e44692ed892d3480b3.tar.gz
minetest-cc3ab5efa527884e40cfc8e44692ed892d3480b3.tar.bz2
minetest-cc3ab5efa527884e40cfc8e44692ed892d3480b3.zip
LuaVoxelManip: Remove blank allocator
Diffstat (limited to 'src/script/lua_api/l_vmanip.cpp')
-rw-r--r--src/script/lua_api/l_vmanip.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/script/lua_api/l_vmanip.cpp b/src/script/lua_api/l_vmanip.cpp
index fb52aa21a..6c12baf92 100644
--- a/src/script/lua_api/l_vmanip.cpp
+++ b/src/script/lua_api/l_vmanip.cpp
@@ -367,6 +367,17 @@ LuaVoxelManip::LuaVoxelManip(Map *map)
this->is_mapgen_vm = false;
}
+LuaVoxelManip::LuaVoxelManip(Map *map, v3s16 p1, v3s16 p2)
+{
+ this->vm = new ManualMapVoxelManipulator(map);
+ this->is_mapgen_vm = false;
+
+ v3s16 bp1 = getNodeBlockPos(p1);
+ v3s16 bp2 = getNodeBlockPos(p2);
+ sortBoxVerticies(bp1, bp2);
+ vm->initialEmerge(bp1, bp2);
+}
+
LuaVoxelManip::~LuaVoxelManip()
{
if (!is_mapgen_vm)
@@ -384,14 +395,9 @@ int LuaVoxelManip::create_object(lua_State *L)
return 0;
Map *map = &(env->getMap());
- LuaVoxelManip *o = new LuaVoxelManip(map);
-
- if (lua_istable(L, 1) && lua_istable(L, 2)) {
- v3s16 p1 = getNodeBlockPos(read_v3s16(L, 1));
- v3s16 p2 = getNodeBlockPos(read_v3s16(L, 2));
- sortBoxVerticies(p1, p2);
- o->vm->initializeBlank(p1, p2);
- }
+ LuaVoxelManip *o = (lua_istable(L, 1) && lua_istable(L, 2)) ?
+ new LuaVoxelManip(map, read_v3s16(L, 1), read_v3s16(L, 2)) :
+ new LuaVoxelManip(map);
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;
luaL_getmetatable(L, className);