From 99c905c5633ebb5aef0ed8af13553c38b892c5e2 Mon Sep 17 00:00:00 2001 From: Duane Robertson Date: Mon, 1 Feb 2016 02:09:43 -0600 Subject: Mgvalleys: fix riverbeds below sea level Stop riverbeds from forming plateaus under sea. Minor corrections to random lava/water placement. --- src/mapgen_valleys.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mapgen_valleys.cpp b/src/mapgen_valleys.cpp index f003ae63c..ceb2c774d 100644 --- a/src/mapgen_valleys.cpp +++ b/src/mapgen_valleys.cpp @@ -99,8 +99,8 @@ MapgenValleys::MapgenValleys(int mapgenid, MapgenParams *params, EmergeManager * this->water_features_lim = rangelim(sp->water_features, 0, 10); // a small chance of overflows if the settings are very high - this->cave_water_max_height = water_level + MYMAX(0, water_features_lim - 6) * 50; - this->lava_max_height = water_level + MYMAX(0, lava_features_lim - 6) * 50; + this->cave_water_max_height = water_level + MYMAX(0, water_features_lim - 4) * 50; + this->lava_max_height = water_level + MYMAX(0, lava_features_lim - 4) * 50; tcave_cache = new float[csize.Y + 2]; @@ -482,7 +482,8 @@ float MapgenValleys::terrainLevelFromNoise(TerrainNoise *tn) // base - depth : height of the bottom of the river // water_level - 6 : don't make rivers below 6 nodes under the surface - mount = rangelim(base - depth, (float) (water_level - 6), mount); + // There is no logical equivalent to this using rangelim. + mount = MYMIN(MYMAX(base - depth, (float) (water_level - 6)), mount); // Slope has no influence on rivers. *tn->slope = 0.f; @@ -846,8 +847,8 @@ void MapgenValleys::generateCaves(s16 max_stone_y) // Reduce the odds of overflows even further. if (node_max.Y > water_level) { - lava_chance /= 5; - water_chance /= 5; + lava_chance /= 3; + water_chance /= 3; } u32 index_2d = 0; -- cgit v1.2.3