mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Dungeons: Move duplicated y limit checks to generation function
This commit is contained in:
parent
b50a166bb0
commit
ec5f591014
@ -886,7 +886,8 @@ bool MapgenBasic::generateCavernsNoise(s16 max_stone_y)
|
|||||||
|
|
||||||
void MapgenBasic::generateDungeons(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;
|
return;
|
||||||
|
|
||||||
u16 num_dungeons = std::fmax(std::floor(
|
u16 num_dungeons = std::fmax(std::floor(
|
||||||
|
@ -313,8 +313,7 @@ void MapgenCarpathian::makeChunk(BlockMakeData *data)
|
|||||||
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
|
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
|
||||||
|
|
||||||
// Generate dungeons
|
// Generate dungeons
|
||||||
if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin &&
|
if (flags & MG_DUNGEONS)
|
||||||
full_node_max.Y <= dungeon_ymax)
|
|
||||||
generateDungeons(stone_surface_max_y);
|
generateDungeons(stone_surface_max_y);
|
||||||
|
|
||||||
// Generate the registered decorations
|
// Generate the registered decorations
|
||||||
|
@ -231,8 +231,7 @@ void MapgenFlat::makeChunk(BlockMakeData *data)
|
|||||||
// Generate the registered ores
|
// Generate the registered ores
|
||||||
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
|
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
|
||||||
|
|
||||||
if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin &&
|
if (flags & MG_DUNGEONS)
|
||||||
full_node_max.Y <= dungeon_ymax)
|
|
||||||
generateDungeons(stone_surface_max_y);
|
generateDungeons(stone_surface_max_y);
|
||||||
|
|
||||||
// Generate the registered decorations
|
// Generate the registered decorations
|
||||||
|
@ -249,8 +249,7 @@ void MapgenFractal::makeChunk(BlockMakeData *data)
|
|||||||
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
|
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
|
||||||
|
|
||||||
// Generate dungeons
|
// Generate dungeons
|
||||||
if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin &&
|
if (flags & MG_DUNGEONS)
|
||||||
full_node_max.Y <= dungeon_ymax)
|
|
||||||
generateDungeons(stone_surface_max_y);
|
generateDungeons(stone_surface_max_y);
|
||||||
|
|
||||||
// Generate the registered decorations
|
// Generate the registered decorations
|
||||||
|
@ -252,8 +252,7 @@ void MapgenV5::makeChunk(BlockMakeData *data)
|
|||||||
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
|
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
|
||||||
|
|
||||||
// Generate dungeons and desert temples
|
// Generate dungeons and desert temples
|
||||||
if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin &&
|
if (flags & MG_DUNGEONS)
|
||||||
full_node_max.Y <= dungeon_ymax)
|
|
||||||
generateDungeons(stone_surface_max_y);
|
generateDungeons(stone_surface_max_y);
|
||||||
|
|
||||||
// Generate the registered decorations
|
// Generate the registered decorations
|
||||||
|
@ -372,8 +372,7 @@ void MapgenV7::makeChunk(BlockMakeData *data)
|
|||||||
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
|
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
|
||||||
|
|
||||||
// Generate dungeons
|
// Generate dungeons
|
||||||
if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin &&
|
if (flags & MG_DUNGEONS)
|
||||||
full_node_max.Y <= dungeon_ymax)
|
|
||||||
generateDungeons(stone_surface_max_y);
|
generateDungeons(stone_surface_max_y);
|
||||||
|
|
||||||
// Generate the registered decorations
|
// Generate the registered decorations
|
||||||
|
@ -260,8 +260,7 @@ void MapgenValleys::makeChunk(BlockMakeData *data)
|
|||||||
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
|
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
|
||||||
|
|
||||||
// Dungeon creation
|
// Dungeon creation
|
||||||
if ((flags & MG_DUNGEONS) && full_node_min.Y >= dungeon_ymin &&
|
if (flags & MG_DUNGEONS)
|
||||||
full_node_max.Y <= dungeon_ymax)
|
|
||||||
generateDungeons(stone_surface_max_y);
|
generateDungeons(stone_surface_max_y);
|
||||||
|
|
||||||
// Generate the registered decorations
|
// Generate the registered decorations
|
||||||
|
Loading…
Reference in New Issue
Block a user