Skip to content

Commit

Permalink
Add 'ores' global mapgen flag (#10276)
Browse files Browse the repository at this point in the history
  • Loading branch information
paramat committed Sep 3, 2020
1 parent 74e22b7 commit 4ba5046
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion builtin/settingtypes.txt
Expand Up @@ -1475,7 +1475,7 @@ mapgen_limit (Map generation limit) int 31000 0 31000
# Global map generation attributes.
# In Mapgen v6 the 'decorations' flag controls all decorations except trees
# and junglegrass, in all other mapgens this flag controls all decorations.
mg_flags (Mapgen flags) flags caves,dungeons,light,decorations,biomes caves,dungeons,light,decorations,biomes,nocaves,nodungeons,nolight,nodecorations,nobiomes
mg_flags (Mapgen flags) flags caves,dungeons,light,decorations,biomes,ores caves,dungeons,light,decorations,biomes,ores,nocaves,nodungeons,nolight,nodecorations,nobiomes,noores

[*Biome API temperature and humidity noise parameters]

Expand Down
3 changes: 2 additions & 1 deletion src/mapgen/mapgen.cpp
Expand Up @@ -58,6 +58,7 @@ FlagDesc flagdesc_mapgen[] = {
{"light", MG_LIGHT},
{"decorations", MG_DECORATIONS},
{"biomes", MG_BIOMES},
{"ores", MG_ORES},
{NULL, 0}
};

Expand Down Expand Up @@ -217,7 +218,7 @@ void Mapgen::getMapgenNames(std::vector<const char *> *mgnames, bool include_hid
void Mapgen::setDefaultSettings(Settings *settings)
{
settings->setDefault("mg_flags", flagdesc_mapgen,
MG_CAVES | MG_DUNGEONS | MG_LIGHT | MG_DECORATIONS | MG_BIOMES);
MG_CAVES | MG_DUNGEONS | MG_LIGHT | MG_DECORATIONS | MG_BIOMES | MG_ORES);

for (int i = 0; i < (int)MAPGEN_INVALID; ++i) {
MapgenParams *params = createMapgenParams((MapgenType)i);
Expand Down
1 change: 1 addition & 0 deletions src/mapgen/mapgen.h
Expand Up @@ -37,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define MG_LIGHT 0x10
#define MG_DECORATIONS 0x20
#define MG_BIOMES 0x40
#define MG_ORES 0x80

typedef u16 biome_t; // copy from mg_biome.h to avoid an unnecessary include

Expand Down
3 changes: 2 additions & 1 deletion src/mapgen/mapgen_carpathian.cpp
Expand Up @@ -315,7 +315,8 @@ void MapgenCarpathian::makeChunk(BlockMakeData *data)
}

// Generate the registered ores
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
if (flags & MG_ORES)
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);

// Generate dungeons
if (flags & MG_DUNGEONS)
Expand Down
3 changes: 2 additions & 1 deletion src/mapgen/mapgen_flat.cpp
Expand Up @@ -264,7 +264,8 @@ void MapgenFlat::makeChunk(BlockMakeData *data)
}

// Generate the registered ores
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
if (flags & MG_ORES)
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);

if (flags & MG_DUNGEONS)
generateDungeons(stone_surface_max_y);
Expand Down
3 changes: 2 additions & 1 deletion src/mapgen/mapgen_fractal.cpp
Expand Up @@ -250,7 +250,8 @@ void MapgenFractal::makeChunk(BlockMakeData *data)
}

// Generate the registered ores
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
if (flags & MG_ORES)
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);

// Generate dungeons
if (flags & MG_DUNGEONS)
Expand Down
3 changes: 2 additions & 1 deletion src/mapgen/mapgen_v5.cpp
Expand Up @@ -257,7 +257,8 @@ void MapgenV5::makeChunk(BlockMakeData *data)
}

// Generate the registered ores
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
if (flags & MG_ORES)
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);

// Generate dungeons and desert temples
if (flags & MG_DUNGEONS)
Expand Down
3 changes: 2 additions & 1 deletion src/mapgen/mapgen_v6.cpp
Expand Up @@ -652,7 +652,8 @@ void MapgenV6::makeChunk(BlockMakeData *data)
m_emerge->decomgr->placeAllDecos(this, blockseed, node_min, node_max);

// Generate the registered ores
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
if (flags & MG_ORES)
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);

// Calculate lighting
if (flags & MG_LIGHT)
Expand Down
3 changes: 2 additions & 1 deletion src/mapgen/mapgen_v7.cpp
Expand Up @@ -377,7 +377,8 @@ void MapgenV7::makeChunk(BlockMakeData *data)
}

// Generate the registered ores
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
if (flags & MG_ORES)
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);

// Generate dungeons
if (flags & MG_DUNGEONS)
Expand Down
3 changes: 2 additions & 1 deletion src/mapgen/mapgen_valleys.cpp
Expand Up @@ -268,7 +268,8 @@ void MapgenValleys::makeChunk(BlockMakeData *data)
}

// Generate the registered ores
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);
if (flags & MG_ORES)
m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max);

// Dungeon creation
if (flags & MG_DUNGEONS)
Expand Down

0 comments on commit 4ba5046

Please sign in to comment.