aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen/mapgen_valleys.cpp
diff options
context:
space:
mode:
authorGael-de-Sailly <gael.chretien@akeonet.com>2018-02-28 18:51:53 +0100
committerparamat <mat.gregory@virginmedia.com>2018-03-03 22:59:26 +0000
commitb952d42000a4038cd759a7829286a33fa91391d3 (patch)
tree1c2dc7ed751e442ef681f656c3b3afffe3b839ba /src/mapgen/mapgen_valleys.cpp
parentebbd158774853a2fae21cb3ee3787803b94d7b93 (diff)
downloadminetest-b952d42000a4038cd759a7829286a33fa91391d3.tar.gz
minetest-b952d42000a4038cd759a7829286a33fa91391d3.tar.bz2
minetest-b952d42000a4038cd759a7829286a33fa91391d3.zip
MapgenValleys: Fixed submarine valleys shape
Diffstat (limited to 'src/mapgen/mapgen_valleys.cpp')
-rw-r--r--src/mapgen/mapgen_valleys.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mapgen/mapgen_valleys.cpp b/src/mapgen/mapgen_valleys.cpp
index 1705dce1c..0c606f3e8 100644
--- a/src/mapgen/mapgen_valleys.cpp
+++ b/src/mapgen/mapgen_valleys.cpp
@@ -40,6 +40,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mg_decoration.h"
#include "mapgen_valleys.h"
#include "cavegen.h"
+#include <cmath>
//#undef NDEBUG
@@ -373,7 +374,7 @@ float MapgenValleys::terrainLevelFromNoise(TerrainNoise *tn)
// (here x = "river" and a = valley_profile).
// "valley" represents the height of the terrain, from the rivers.
{
- float t = river / tn->valley_profile;
+ float t = std::fmax(river / tn->valley_profile, 0.0f);
*tn->valley = valley_d * (1.f - exp(- MYSQUARE(t)));
}