diff options
Diffstat (limited to 'src/mapgen_v5.cpp')
-rw-r--r-- | src/mapgen_v5.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mapgen_v5.cpp b/src/mapgen_v5.cpp index 64879b0bb..24c81e56d 100644 --- a/src/mapgen_v5.cpp +++ b/src/mapgen_v5.cpp @@ -252,7 +252,8 @@ void MapgenV5::makeChunk(BlockMakeData *data) calculateNoise(); // Generate base terrain - generateBaseTerrain(); + s16 stone_surface_max_y = generateBaseTerrain(); + updateHeightmap(node_min, node_max); // Generate underground dirt, sand, gravel and lava blobs @@ -268,7 +269,7 @@ void MapgenV5::makeChunk(BlockMakeData *data) generateBiomes(); // Generate dungeons and desert temples - if (flags & MG_DUNGEONS) { + if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) { DungeonGen dgen(this, NULL); dgen.generate(blockseed, full_node_min, full_node_max); } @@ -342,10 +343,11 @@ void MapgenV5::calculateNoise() // Make base ground level -void MapgenV5::generateBaseTerrain() +int MapgenV5::generateBaseTerrain() { u32 index = 0; u32 index2d = 0; + int stone_surface_max_y = -MAP_GENERATION_LIMIT; for(s16 z=node_min.Z; z<=node_max.Z; z++) { for(s16 y=node_min.Y - 1; y<=node_max.Y + 1; y++) { @@ -372,12 +374,16 @@ void MapgenV5::generateBaseTerrain() vm->m_data[i] = MapNode(CONTENT_AIR); } else { vm->m_data[i] = MapNode(c_stone); + if (y > stone_surface_max_y) + stone_surface_max_y = y; } } index2d = index2d - ystride; } index2d = index2d + ystride; } + + return stone_surface_max_y; } |