summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_vmanip.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-01-04 03:07:28 -0500
committerkwolekr <kwolekr@minetest.net>2015-01-04 03:07:28 -0500
commitef8ed5d127f2c698586efdfd254c8e5c7ba66f19 (patch)
treed27296c77c3d202626b66ebfce43e8a3260282fb /src/script/lua_api/l_vmanip.cpp
parent7233a1228eb161cbcbb46c6e801cabd89ef3d2ab (diff)
downloadminetest-ef8ed5d127f2c698586efdfd254c8e5c7ba66f19.tar.gz
minetest-ef8ed5d127f2c698586efdfd254c8e5c7ba66f19.tar.bz2
minetest-ef8ed5d127f2c698586efdfd254c8e5c7ba66f19.zip
LuaVoxelManip: Error when given out-of-bounds area
Diffstat (limited to 'src/script/lua_api/l_vmanip.cpp')
-rw-r--r--src/script/lua_api/l_vmanip.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/script/lua_api/l_vmanip.cpp b/src/script/lua_api/l_vmanip.cpp
index bf702eaff..29f04f052 100644
--- a/src/script/lua_api/l_vmanip.cpp
+++ b/src/script/lua_api/l_vmanip.cpp
@@ -171,6 +171,8 @@ int LuaVoxelManip::l_calc_lighting(lua_State *L)
v3s16 p1 = lua_istable(L, 2) ? read_v3s16(L, 2) : vm->m_area.MinEdge;
v3s16 p2 = lua_istable(L, 3) ? read_v3s16(L, 3) : vm->m_area.MaxEdge;
sortBoxVerticies(p1, p2);
+ if (!vm->m_area.contains(VoxelArea(p1, p2)))
+ throw LuaError("Specified voxel area out of VoxelManipulator bounds");
Mapgen mg;
mg.vm = vm;
@@ -206,6 +208,8 @@ int LuaVoxelManip::l_set_lighting(lua_State *L)
v3s16 p1 = lua_istable(L, 3) ? read_v3s16(L, 3) : vm->m_area.MinEdge;
v3s16 p2 = lua_istable(L, 4) ? read_v3s16(L, 4) : vm->m_area.MaxEdge;
sortBoxVerticies(p1, p2);
+ if (!vm->m_area.contains(VoxelArea(p1, p2)))
+ throw LuaError("Specified voxel area out of VoxelManipulator bounds");
Mapgen mg;
mg.vm = vm;