aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2013-06-23 15:16:52 -0400
committerkwolekr <kwolekr@minetest.net>2013-06-23 15:16:52 -0400
commit30d6d4c7335112f92408057b3bc7cf02ff645ca5 (patch)
tree3386c58e554d47cd6edea10685e59dbe6c87171a
parentf764297be2d55c9b8350077e44e3d62a9e058bcf (diff)
downloadminetest-30d6d4c7335112f92408057b3bc7cf02ff645ca5.tar.gz
minetest-30d6d4c7335112f92408057b3bc7cf02ff645ca5.tar.bz2
minetest-30d6d4c7335112f92408057b3bc7cf02ff645ca5.zip
Cavegen: fix division by 0 with abnormal max tunnel diameter sizes
-rw-r--r--src/cavegen.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cavegen.cpp b/src/cavegen.cpp
index 01543252a..8e6798586 100644
--- a/src/cavegen.cpp
+++ b/src/cavegen.cpp
@@ -70,7 +70,7 @@ void CaveV6::makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height) {
//(this should be more than the maximum radius of the tunnel)
const s16 max_spread_amount = MAP_BLOCKSIZE;
s16 insure = 10;
- s16 more = max_spread_amount - max_tunnel_diameter / 2 - insure;
+ s16 more = MYMAX(max_spread_amount - max_tunnel_diameter / 2 - insure, 1);
ar += v3s16(1,0,1) * more * 2;
of -= v3s16(1,0,1) * more;