Skip to content

Commit

Permalink
Correct overflowing rivers in Valleys mapgen.
Browse files Browse the repository at this point in the history
  • Loading branch information
duane-r authored and paramat committed Jan 18, 2016
1 parent 13e7589 commit eb6e2c1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mapgen_valleys.cpp
Expand Up @@ -670,8 +670,8 @@ int MapgenValleys::generateTerrain()

for (s16 z = node_min.Z; z <= node_max.Z; z++)
for (s16 x = node_min.X; x <= node_max.X; x++, index_2d++) {
s16 river_y = round(noise_rivers->result[index_2d]);
s16 surface_y = round(noise_terrain_height->result[index_2d]);
s16 river_y = floor(noise_rivers->result[index_2d]);
s16 surface_y = floor(noise_terrain_height->result[index_2d]);
float slope = noise_inter_valley_slope->result[index_2d];

heightmap[index_2d] = surface_y;
Expand Down Expand Up @@ -703,7 +703,7 @@ int MapgenValleys::generateTerrain()
} else if (river && y < river_y) {
// river
vm->m_data[index_data] = n_river_water;
} else if ((!fast_terrain) && (!river) && fill * slope > y - surface_y) {
} else if ((!fast_terrain) && (!river) && round(fill * slope) >= y - surface_y) {
// ground (slow method)
vm->m_data[index_data] = n_stone;
heightmap[index_2d] = surface_max_y = y;
Expand Down

0 comments on commit eb6e2c1

Please sign in to comment.