Skip to content


Mgvalleys: Fix missing decorations and incorrect function order
Browse files Browse the repository at this point in the history
Fix missing decorations at horizontal chunk borders by adding
'updateHeightmap()' after terrain generation.

Swap order of 'calculateNoise' and 'calcBiomeNoise' because
'calculateNoise' modifies the heat and humidity maps created in

Remove confusing comment, code block is not just for mods and
seems essential for correct mapgen behaviour.
  • Loading branch information
paramat committed Feb 1, 2017
1 parent d873545 commit 326cc5d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/mapgen_valleys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,21 @@ void MapgenValleys::makeChunk(BlockMakeData *data)

blockseed = getBlockSeed2(full_node_min, seed);

// Generate noise maps and base terrain height.

// Generate biome noises. Note this must be executed strictly before
// generateTerrain, because generateTerrain depends on intermediate
// biome-related noises.

// Generate noise maps and base terrain height.
// Modify heat and humidity maps.

// Generate base terrain with initial heightmaps
s16 stone_surface_max_y = generateTerrain();

// Recalculate heightmap
updateHeightmap(node_min, node_max);

// Place biome-specific nodes and build biomemap
MgStoneType stone_type = generateBiomes();

Expand Down Expand Up @@ -549,10 +553,6 @@ int MapgenValleys::generateTerrain()
index_3d += ystride;

// This happens if we're generating a chunk that doesn't
// contain the terrain surface, in which case, we need
// to set heightmap to a value outside of the chunk,
// to avoid confusing lua mods that use heightmap.
if (heightmap[index_2d] == -MAX_MAP_GENERATION_LIMIT) {
s16 surface_y_int = myround(surface_y);
if (surface_y_int > node_max.Y + 1 || surface_y_int < node_min.Y - 1) {
Expand Down

0 comments on commit 326cc5d

Please sign in to comment.