Skip to content

Commit 99c905c

Browse files
duane-rparamat
authored andcommittedFeb 2, 2016
Mgvalleys: fix riverbeds below sea level
Stop riverbeds from forming plateaus under sea. Minor corrections to random lava/water placement.
1 parent 0a8af88 commit 99c905c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
 

‎src/mapgen_valleys.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ MapgenValleys::MapgenValleys(int mapgenid, MapgenParams *params, EmergeManager *
9999
this->water_features_lim = rangelim(sp->water_features, 0, 10);
100100

101101
// a small chance of overflows if the settings are very high
102-
this->cave_water_max_height = water_level + MYMAX(0, water_features_lim - 6) * 50;
103-
this->lava_max_height = water_level + MYMAX(0, lava_features_lim - 6) * 50;
102+
this->cave_water_max_height = water_level + MYMAX(0, water_features_lim - 4) * 50;
103+
this->lava_max_height = water_level + MYMAX(0, lava_features_lim - 4) * 50;
104104

105105
tcave_cache = new float[csize.Y + 2];
106106

@@ -482,7 +482,8 @@ float MapgenValleys::terrainLevelFromNoise(TerrainNoise *tn)
482482

483483
// base - depth : height of the bottom of the river
484484
// water_level - 6 : don't make rivers below 6 nodes under the surface
485-
mount = rangelim(base - depth, (float) (water_level - 6), mount);
485+
// There is no logical equivalent to this using rangelim.
486+
mount = MYMIN(MYMAX(base - depth, (float) (water_level - 6)), mount);
486487

487488
// Slope has no influence on rivers.
488489
*tn->slope = 0.f;
@@ -846,8 +847,8 @@ void MapgenValleys::generateCaves(s16 max_stone_y)
846847

847848
// Reduce the odds of overflows even further.
848849
if (node_max.Y > water_level) {
849-
lava_chance /= 5;
850-
water_chance /= 5;
850+
lava_chance /= 3;
851+
water_chance /= 3;
851852
}
852853

853854
u32 index_2d = 0;

0 commit comments

Comments
 (0)
Please sign in to comment.