Skip to content

Commit 5699980

Browse files
committedJun 2, 2016
Mgv7: Always carve river channels in mountain terrain
Previously, rivers were sometimes blocked by vertical walls of mountain terrain due to river carving being disabled when base terrain height was below water_level - 16 Remove now unused base terrain heightmap created in generateTerrain()
1 parent 14ef2b4 commit 5699980

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed
 

‎src/mapgen_v7.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,15 @@ void MapgenV7::makeChunk(BlockMakeData *data)
206206

207207
blockseed = getBlockSeed2(full_node_min, seed);
208208

209-
// Generate terrain and ridges with initial heightmaps
209+
// Generate base and mountain terrain
210+
// An initial heightmap is no longer created here for use in generateRidgeTerrain()
210211
s16 stone_surface_max_y = generateTerrain();
211212

213+
// Generate rivers
212214
if (spflags & MGV7_RIDGES)
213215
generateRidgeTerrain();
214216

215-
// Update heightmap to include mountain terrain
217+
// Create heightmap
216218
updateHeightmap(node_min, node_max);
217219

218220
// Init biome generator, place biome-specific nodes, and build biomemap
@@ -331,7 +333,6 @@ int MapgenV7::generateTerrain()
331333
for (s16 z = node_min.Z; z <= node_max.Z; z++)
332334
for (s16 x = node_min.X; x <= node_max.X; x++, index2d++) {
333335
s16 surface_y = baseTerrainLevelFromMap(index2d);
334-
heightmap[index2d] = surface_y; // Create base terrain heightmap
335336

336337
if (surface_y > stone_surface_max_y)
337338
stone_surface_max_y = surface_y;
@@ -382,9 +383,6 @@ void MapgenV7::generateRidgeTerrain()
382383
for (s16 x = node_min.X; x <= node_max.X; x++, index++, vi++) {
383384
int j = (z - node_min.Z) * csize.X + (x - node_min.X);
384385

385-
if (heightmap[j] < water_level - 16) // Use base terrain heightmap
386-
continue;
387-
388386
float uwatern = noise_ridge_uwater->result[j] * 2;
389387
if (fabs(uwatern) > width)
390388
continue;

0 commit comments

Comments
 (0)
Please sign in to comment.