From: paramat Date: Fri, 22 Nov 2019 19:48:18 +0000 (+0000) Subject: Dungeons: Move duplicated y limit checks to generation function X-Git-Tag: 5.2.0~275 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ec5f59101428d66ce716143fedd34445a4fdcac0;p=oweals%2Fminetest.git Dungeons: Move duplicated y limit checks to generation function --- diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp index f465c05a0..5c6a95a82 100644 --- a/src/mapgen/mapgen.cpp +++ b/src/mapgen/mapgen.cpp @@ -886,7 +886,8 @@ bool MapgenBasic::generateCavernsNoise(s16 max_stone_y) void MapgenBasic::generateDungeons(s16 max_stone_y) { - if (max_stone_y < node_min.Y) + if (node_min.Y > max_stone_y || node_min.Y > dungeon_ymax || + node_max.Y < dungeon_ymin) return; u16 num_dungeons = std::fmax(std::floor( diff --git a/src/mapgen/mapgen_carpathian.cpp b/src/mapgen/mapgen_carpathian.cpp index b0783c998..67f542c0d 100644 --- a/src/mapgen/mapgen_carpathian.cpp +++ b/src/mapgen/mapgen_carpathian.cpp @@ -313,8 +313,7 @@ void MapgenCarpathian::makeChunk(BlockMakeData *data) m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max); // Generate dungeons - if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin && - full_node_max.Y <= dungeon_ymax) + if (flags & MG_DUNGEONS) generateDungeons(stone_surface_max_y); // Generate the registered decorations diff --git a/src/mapgen/mapgen_flat.cpp b/src/mapgen/mapgen_flat.cpp index 5cd475202..656e7d72c 100644 --- a/src/mapgen/mapgen_flat.cpp +++ b/src/mapgen/mapgen_flat.cpp @@ -231,8 +231,7 @@ void MapgenFlat::makeChunk(BlockMakeData *data) // Generate the registered ores m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max); - if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin && - full_node_max.Y <= dungeon_ymax) + if (flags & MG_DUNGEONS) generateDungeons(stone_surface_max_y); // Generate the registered decorations diff --git a/src/mapgen/mapgen_fractal.cpp b/src/mapgen/mapgen_fractal.cpp index 0431714fe..1ac57cede 100644 --- a/src/mapgen/mapgen_fractal.cpp +++ b/src/mapgen/mapgen_fractal.cpp @@ -249,8 +249,7 @@ void MapgenFractal::makeChunk(BlockMakeData *data) m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max); // Generate dungeons - if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin && - full_node_max.Y <= dungeon_ymax) + if (flags & MG_DUNGEONS) generateDungeons(stone_surface_max_y); // Generate the registered decorations diff --git a/src/mapgen/mapgen_v5.cpp b/src/mapgen/mapgen_v5.cpp index 73fc42295..c003c27d6 100644 --- a/src/mapgen/mapgen_v5.cpp +++ b/src/mapgen/mapgen_v5.cpp @@ -252,8 +252,7 @@ void MapgenV5::makeChunk(BlockMakeData *data) m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max); // Generate dungeons and desert temples - if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin && - full_node_max.Y <= dungeon_ymax) + if (flags & MG_DUNGEONS) generateDungeons(stone_surface_max_y); // Generate the registered decorations diff --git a/src/mapgen/mapgen_v7.cpp b/src/mapgen/mapgen_v7.cpp index a3cd8a557..43b73ebae 100644 --- a/src/mapgen/mapgen_v7.cpp +++ b/src/mapgen/mapgen_v7.cpp @@ -372,8 +372,7 @@ void MapgenV7::makeChunk(BlockMakeData *data) m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max); // Generate dungeons - if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin && - full_node_max.Y <= dungeon_ymax) + if (flags & MG_DUNGEONS) generateDungeons(stone_surface_max_y); // Generate the registered decorations diff --git a/src/mapgen/mapgen_valleys.cpp b/src/mapgen/mapgen_valleys.cpp index c4ea5067d..3c6045105 100644 --- a/src/mapgen/mapgen_valleys.cpp +++ b/src/mapgen/mapgen_valleys.cpp @@ -260,8 +260,7 @@ void MapgenValleys::makeChunk(BlockMakeData *data) m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max); // Dungeon creation - if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin && - full_node_max.Y <= dungeon_ymax) + if (flags & MG_DUNGEONS) generateDungeons(stone_surface_max_y); // Generate the registered decorations