From d7bbe81726f46b46d88b188298155dc7519ae1a4 Mon Sep 17 00:00:00 2001 From: paramat Date: Sun, 15 Nov 2015 11:55:45 +0000 Subject: Mapgen: Add global 'decorations' flag Flag is set by default in MapgenParams The global 'trees' flag remains but is now undocumented and unset by default in MapgenParams Add mgv6_spflag 'trees' set by default in defaultsettings.cpp to affect new worlds only This is automatically backwards compatible for existing worlds --- src/defaultsettings.cpp | 2 +- src/mapgen.cpp | 11 ++++++----- src/mapgen.h | 13 +++++++------ src/mapgen_flat.cpp | 3 ++- src/mapgen_fractal.cpp | 3 ++- src/mapgen_v5.cpp | 3 ++- src/mapgen_v6.cpp | 6 ++++-- src/mapgen_v6.h | 1 + src/mapgen_v7.cpp | 3 ++- 9 files changed, 27 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 3315f4aaa..42eddb8ce 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -313,7 +313,7 @@ void set_default_settings(Settings *settings) settings->setDefault("water_level", "1"); settings->setDefault("chunksize", "5"); settings->setDefault("mg_flags", "dungeons"); - settings->setDefault("mgv6_spflags", "jungles, snowbiomes"); + settings->setDefault("mgv6_spflags", "jungles, snowbiomes, trees"); // IPv6 settings->setDefault("enable_ipv6", "true"); diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 8a77000fa..5a209eddd 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -41,11 +41,12 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "log.h" FlagDesc flagdesc_mapgen[] = { - {"trees", MG_TREES}, - {"caves", MG_CAVES}, - {"dungeons", MG_DUNGEONS}, - {"flat", MG_FLAT}, - {"light", MG_LIGHT}, + {"trees", MG_TREES}, + {"caves", MG_CAVES}, + {"dungeons", MG_DUNGEONS}, + {"flat", MG_FLAT}, + {"light", MG_LIGHT}, + {"decorations", MG_DECORATIONS}, {NULL, 0} }; diff --git a/src/mapgen.h b/src/mapgen.h index 57e995847..31cf7dc11 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -29,11 +29,12 @@ with this program; if not, write to the Free Software Foundation, Inc., #define DEFAULT_MAPGEN "v6" /////////////////// Mapgen flags -#define MG_TREES 0x01 -#define MG_CAVES 0x02 -#define MG_DUNGEONS 0x04 -#define MG_FLAT 0x08 -#define MG_LIGHT 0x10 +#define MG_TREES 0x01 +#define MG_CAVES 0x02 +#define MG_DUNGEONS 0x04 +#define MG_FLAT 0x08 +#define MG_LIGHT 0x10 +#define MG_DECORATIONS 0x20 class Settings; class MMVManip; @@ -126,7 +127,7 @@ struct MapgenParams { chunksize(5), seed(0), water_level(1), - flags(MG_TREES | MG_CAVES | MG_LIGHT), + flags(MG_CAVES | MG_LIGHT | MG_DECORATIONS), np_biome_heat(NoiseParams(50, 50, v3f(750.0, 750.0, 750.0), 5349, 3, 0.5, 2.0)), np_biome_heat_blend(NoiseParams(0, 1.5, v3f(8.0, 8.0, 8.0), 13, 2, 1.0, 2.0)), np_biome_humidity(NoiseParams(50, 50, v3f(750.0, 750.0, 750.0), 842, 3, 0.5, 2.0)), diff --git a/src/mapgen_flat.cpp b/src/mapgen_flat.cpp index 7a8fe18a6..1b41d0acf 100644 --- a/src/mapgen_flat.cpp +++ b/src/mapgen_flat.cpp @@ -296,7 +296,8 @@ void MapgenFlat::makeChunk(BlockMakeData *data) } // Generate the registered decorations - m_emerge->decomgr->placeAllDecos(this, blockseed, node_min, node_max); + if (flags & MG_DECORATIONS) + m_emerge->decomgr->placeAllDecos(this, blockseed, node_min, node_max); // Generate the registered ores m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max); diff --git a/src/mapgen_fractal.cpp b/src/mapgen_fractal.cpp index 89d4e53d3..26ebec353 100644 --- a/src/mapgen_fractal.cpp +++ b/src/mapgen_fractal.cpp @@ -310,7 +310,8 @@ void MapgenFractal::makeChunk(BlockMakeData *data) } // Generate the registered decorations - m_emerge->decomgr->placeAllDecos(this, blockseed, node_min, node_max); + if (flags & MG_DECORATIONS) + m_emerge->decomgr->placeAllDecos(this, blockseed, node_min, node_max); // Generate the registered ores m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max); diff --git a/src/mapgen_v5.cpp b/src/mapgen_v5.cpp index 10e9f5e65..3d7e3bf83 100644 --- a/src/mapgen_v5.cpp +++ b/src/mapgen_v5.cpp @@ -296,7 +296,8 @@ void MapgenV5::makeChunk(BlockMakeData *data) } // Generate the registered decorations - m_emerge->decomgr->placeAllDecos(this, blockseed, node_min, node_max); + if (flags & MG_DECORATIONS) + m_emerge->decomgr->placeAllDecos(this, blockseed, node_min, node_max); // Generate the registered ores m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max); diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index 3f3ccba4f..3b5915bd1 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -43,6 +43,7 @@ FlagDesc flagdesc_mapgen_v6[] = { {"mudflow", MGV6_MUDFLOW}, {"snowbiomes", MGV6_SNOWBIOMES}, {"flat", MGV6_FLAT}, + {"trees", MGV6_TREES}, {NULL, 0} }; @@ -580,11 +581,12 @@ void MapgenV6::makeChunk(BlockMakeData *data) growGrass(); // Generate some trees, and add grass, if a jungle - if (flags & MG_TREES) + if ((spflags & MGV6_TREES) || (flags & MG_TREES)) placeTreesAndJungleGrass(); // Generate the registered decorations - m_emerge->decomgr->placeAllDecos(this, blockseed, node_min, node_max); + if (flags & MG_DECORATIONS) + m_emerge->decomgr->placeAllDecos(this, blockseed, node_min, node_max); // Generate the registered ores m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max); diff --git a/src/mapgen_v6.h b/src/mapgen_v6.h index dec92ab48..612e2322a 100644 --- a/src/mapgen_v6.h +++ b/src/mapgen_v6.h @@ -37,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define MGV6_MUDFLOW 0x04 #define MGV6_SNOWBIOMES 0x08 #define MGV6_FLAT 0x10 +#define MGV6_TREES 0x20 extern FlagDesc flagdesc_mapgen_v6[]; diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp index 77b9721c7..679d860dc 100644 --- a/src/mapgen_v7.cpp +++ b/src/mapgen_v7.cpp @@ -317,7 +317,8 @@ void MapgenV7::makeChunk(BlockMakeData *data) } // Generate the registered decorations - m_emerge->decomgr->placeAllDecos(this, blockseed, node_min, node_max); + if (flags & MG_DECORATIONS) + m_emerge->decomgr->placeAllDecos(this, blockseed, node_min, node_max); // Generate the registered ores m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max); -- cgit v1.2.3