diff options
author | paramat <paramat@users.noreply.github.com> | 2019-11-22 19:48:18 +0000 |
---|---|---|
committer | Paramat <paramat@users.noreply.github.com> | 2019-11-23 01:41:27 +0000 |
commit | ec5f59101428d66ce716143fedd34445a4fdcac0 (patch) | |
tree | 00b7331a57e7a9f6a9f32fd8de79072305040a56 /src/mapgen | |
parent | b50a166bb05c4ebe1bf757190f4045d57a0d5f20 (diff) | |
download | minetest-ec5f59101428d66ce716143fedd34445a4fdcac0.tar.gz minetest-ec5f59101428d66ce716143fedd34445a4fdcac0.tar.bz2 minetest-ec5f59101428d66ce716143fedd34445a4fdcac0.zip |
Dungeons: Move duplicated y limit checks to generation function
Diffstat (limited to 'src/mapgen')
-rw-r--r-- | src/mapgen/mapgen.cpp | 3 | ||||
-rw-r--r-- | src/mapgen/mapgen_carpathian.cpp | 3 | ||||
-rw-r--r-- | src/mapgen/mapgen_flat.cpp | 3 | ||||
-rw-r--r-- | src/mapgen/mapgen_fractal.cpp | 3 | ||||
-rw-r--r-- | src/mapgen/mapgen_v5.cpp | 3 | ||||
-rw-r--r-- | src/mapgen/mapgen_v7.cpp | 3 | ||||
-rw-r--r-- | src/mapgen/mapgen_valleys.cpp | 3 |
7 files changed, 8 insertions, 13 deletions
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 |