aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorparamat <mat.gregory@virginmedia.com>2017-01-30 18:06:17 +0000
committerparamat <mat.gregory@virginmedia.com>2017-02-01 15:05:35 +0000
commit326cc5df741120dcfdfef21a7acaef5322601764 (patch)
treee477aeee5d8819e605028355c128e150ccb6c845 /src
parentd873545ac70331a224967493f9296a854d292dd8 (diff)
downloadminetest-326cc5df741120dcfdfef21a7acaef5322601764.tar.gz
minetest-326cc5df741120dcfdfef21a7acaef5322601764.tar.bz2
minetest-326cc5df741120dcfdfef21a7acaef5322601764.zip
Mgvalleys: Fix missing decorations and incorrect function order
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 'calcBiomeNoise'. Remove confusing comment, code block is not just for mods and seems essential for correct mapgen behaviour.
Diffstat (limited to 'src')
-rw-r--r--src/mapgen_valleys.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mapgen_valleys.cpp b/src/mapgen_valleys.cpp
index ce7a95329..ccf797eff 100644
--- a/src/mapgen_valleys.cpp
+++ b/src/mapgen_valleys.cpp
@@ -238,17 +238,21 @@ void MapgenValleys::makeChunk(BlockMakeData *data)
blockseed = getBlockSeed2(full_node_min, seed);
- // Generate noise maps and base terrain height.
- calculateNoise();
-
// Generate biome noises. Note this must be executed strictly before
// generateTerrain, because generateTerrain depends on intermediate
// biome-related noises.
m_bgen->calcBiomeNoise(node_min);
+ // Generate noise maps and base terrain height.
+ // Modify heat and humidity maps.
+ calculateNoise();
+
// 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();
@@ -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) {