summaryrefslogtreecommitdiff
path: root/src/mapgen_v5.cpp
diff options
context:
space:
mode:
authorparamat <mat.gregory@virginmedia.com>2016-03-13 07:56:27 +0000
committerparamat <mat.gregory@virginmedia.com>2016-03-14 08:45:01 +0000
commitbb2ee54d3b841ebdb6c6a0b6573b64216ae0baae (patch)
tree89e43502d2e9c1791a53e6f280a71f9ec0790fed /src/mapgen_v5.cpp
parentc0b6986e3875e6f42682c78fd5db0080a7bae651 (diff)
downloadminetest-bb2ee54d3b841ebdb6c6a0b6573b64216ae0baae.tar.gz
minetest-bb2ee54d3b841ebdb6c6a0b6573b64216ae0baae.tar.bz2
minetest-bb2ee54d3b841ebdb6c6a0b6573b64216ae0baae.zip
Mapgen: Fix light in tunnels at mapchunk borders
Don't excavate the overgenerated stone at node_max.Y + 1, this creates a 'roof' over the tunnel, preventing light in tunnels at mapchunk borders when generating mapchunks upwards.
Diffstat (limited to 'src/mapgen_v5.cpp')
-rw-r--r--src/mapgen_v5.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mapgen_v5.cpp b/src/mapgen_v5.cpp
index 0bb3715a8..e9b1b58b3 100644
--- a/src/mapgen_v5.cpp
+++ b/src/mapgen_v5.cpp
@@ -519,6 +519,12 @@ void MapgenV5::generateCaves(int max_stone_y)
for (s16 y = node_min.Y - 1; y <= node_max.Y + 1; y++) {
u32 vi = vm->m_area.index(node_min.X, y, z);
for (s16 x = node_min.X; x <= node_max.X; x++, vi++, index++) {
+ // Don't excavate the overgenerated stone at node_max.Y + 1,
+ // this creates a 'roof' over the tunnel, preventing light in
+ // tunnels at mapchunk borders when generating mapchunks upwards.
+ if (y > node_max.Y)
+ continue;
+
float d1 = contour(noise_cave1->result[index]);
float d2 = contour(noise_cave2->result[index]);
if (d1 * d2 > 0.125f) {