aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen_v6.cpp
diff options
context:
space:
mode:
authorWeblate <42@minetest.ru>2013-03-31 12:27:05 +0200
committerWeblate <42@minetest.ru>2013-03-31 12:27:05 +0200
commit319662c0ed047c6604d802336b54c325867fcab9 (patch)
tree5e30a3f9568ddafc41420f8d5bedc1c5dacce6e2 /src/mapgen_v6.cpp
parent5b597a6bfacda92006d153159929c8d777b4df89 (diff)
parenta2e5706661b2aa4796c01a251bc05ae3eb93f9d6 (diff)
downloadminetest-319662c0ed047c6604d802336b54c325867fcab9.tar.gz
minetest-319662c0ed047c6604d802336b54c325867fcab9.tar.bz2
minetest-319662c0ed047c6604d802336b54c325867fcab9.zip
Merge remote branch 'origin/master'
Diffstat (limited to 'src/mapgen_v6.cpp')
-rw-r--r--src/mapgen_v6.cpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp
index 0b419617d..275d4b78f 100644
--- a/src/mapgen_v6.cpp
+++ b/src/mapgen_v6.cpp
@@ -928,20 +928,20 @@ void MapgenV6::growGrass() {
void MapgenV6::defineCave(Cave &cave, PseudoRandom ps,
v3s16 node_min, bool large_cave) {
- cave.min_tunnel_diameter = 2;
- cave.max_tunnel_diameter = ps.range(2,6);
- cave.dswitchint = ps.range(1,14);
- cave.flooded = true; //large_cave && ps.range(0,4);
- if(large_cave){
- cave.part_max_length_rs = ps.range(2,4);
- cave.tunnel_routepoints = ps.range(5, ps.range(15,30));
- cave.min_tunnel_diameter = 5;
- cave.max_tunnel_diameter = ps.range(7, ps.range(8,24));
- } else {
- cave.part_max_length_rs = ps.range(2,9);
- cave.tunnel_routepoints = ps.range(10, ps.range(15,30));
- }
- cave.large_cave_is_flat = (ps.range(0,1) == 0);
+ cave.min_tunnel_diameter = 2;
+ cave.max_tunnel_diameter = ps.range(2,6);
+ cave.dswitchint = ps.range(1,14);
+ cave.flooded = true; //large_cave && ps.range(0,4);
+ if (large_cave){
+ cave.part_max_length_rs = ps.range(2,4);
+ cave.tunnel_routepoints = ps.range(5, ps.range(15,30));
+ cave.min_tunnel_diameter = 5;
+ cave.max_tunnel_diameter = ps.range(7, ps.range(8,24));
+ } else {
+ cave.part_max_length_rs = ps.range(2,9);
+ cave.tunnel_routepoints = ps.range(10, ps.range(15,30));
+ }
+ cave.large_cave_is_flat = (ps.range(0,1) == 0);
}
@@ -1120,7 +1120,13 @@ void MapgenV6::generateCaves(int max_stone_y) {
rp.Z = ar.Z-1;
vec = rp - orp;
- for(float f=0; f<1.0; f+=1.0/vec.getLength())
+ float veclen = vec.getLength();
+ // As odd as it sounds, veclen is *exactly*
+ // 0.0 sometimes, causing a FPE
+ if (veclen == 0.0)
+ veclen = 1.0;
+
+ for(float f=0; f<1.0; f+=1.0/veclen)
{
v3f fp = orp + vec * f;
fp.X += 0.1*ps.range(-10,10);