diff options
Diffstat (limited to 'src/mapgen')
-rw-r--r-- | src/mapgen/mapgen.cpp | 13 | ||||
-rw-r--r-- | src/mapgen/mapgen.h | 7 | ||||
-rw-r--r-- | src/mapgen/mapgen_carpathian.cpp | 8 | ||||
-rw-r--r-- | src/mapgen/mapgen_carpathian.h | 2 | ||||
-rw-r--r-- | src/mapgen/mapgen_flat.cpp | 8 | ||||
-rw-r--r-- | src/mapgen/mapgen_flat.h | 2 | ||||
-rw-r--r-- | src/mapgen/mapgen_fractal.cpp | 9 | ||||
-rw-r--r-- | src/mapgen/mapgen_fractal.h | 2 | ||||
-rw-r--r-- | src/mapgen/mapgen_v5.cpp | 11 | ||||
-rw-r--r-- | src/mapgen/mapgen_v5.h | 2 | ||||
-rw-r--r-- | src/mapgen/mapgen_v6.cpp | 10 | ||||
-rw-r--r-- | src/mapgen/mapgen_v6.h | 3 | ||||
-rw-r--r-- | src/mapgen/mapgen_v7.cpp | 9 | ||||
-rw-r--r-- | src/mapgen/mapgen_v7.h | 2 | ||||
-rw-r--r-- | src/mapgen/mapgen_valleys.cpp | 13 | ||||
-rw-r--r-- | src/mapgen/mapgen_valleys.h | 3 |
16 files changed, 86 insertions, 18 deletions
diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp index 81ccf1f8d..79c429ff6 100644 --- a/src/mapgen/mapgen.cpp +++ b/src/mapgen/mapgen.cpp @@ -215,6 +215,17 @@ 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); + + for (int i = 0; i < (int)MAPGEN_INVALID; ++i) { + MapgenParams *params = createMapgenParams((MapgenType)i); + params->setDefaultSettings(settings); + delete params; + } +} u32 Mapgen::getBlockSeed(v3s16 p, s32 seed) { @@ -1068,7 +1079,7 @@ void MapgenParams::writeParams(Settings *settings) const settings->setS16("water_level", water_level); settings->setS16("mapgen_limit", mapgen_limit); settings->setS16("chunksize", chunksize); - settings->setFlagStr("mg_flags", flags, flagdesc_mapgen, U32_MAX); + settings->setFlagStr("mg_flags", flags, flagdesc_mapgen); if (bparams) bparams->writeParams(settings); diff --git a/src/mapgen/mapgen.h b/src/mapgen/mapgen.h index 1473d41a6..dc325c791 100644 --- a/src/mapgen/mapgen.h +++ b/src/mapgen/mapgen.h @@ -124,7 +124,9 @@ struct MapgenParams { u64 seed = 0; s16 water_level = 1; s16 mapgen_limit = MAX_MAP_GENERATION_LIMIT; - u32 flags = MG_CAVES | MG_LIGHT | MG_DECORATIONS | MG_BIOMES; + // Flags set in readParams + u32 flags = 0; + u32 spflags = 0; BiomeParams *bparams = nullptr; @@ -133,6 +135,8 @@ struct MapgenParams { virtual void readParams(const Settings *settings); virtual void writeParams(Settings *settings) const; + // Default settings for g_settings such as flags + virtual void setDefaultSettings(Settings *settings) {}; s32 getSpawnRangeMax(); @@ -214,6 +218,7 @@ public: EmergeManager *emerge); static MapgenParams *createMapgenParams(MapgenType mgtype); static void getMapgenNames(std::vector<const char *> *mgnames, bool include_hidden); + static void setDefaultSettings(Settings *settings); private: // isLiquidHorizontallyFlowable() is a helper function for updateLiquid() diff --git a/src/mapgen/mapgen_carpathian.cpp b/src/mapgen/mapgen_carpathian.cpp index 67f542c0d..0dc1d33be 100644 --- a/src/mapgen/mapgen_carpathian.cpp +++ b/src/mapgen/mapgen_carpathian.cpp @@ -187,7 +187,7 @@ void MapgenCarpathianParams::readParams(const Settings *settings) void MapgenCarpathianParams::writeParams(Settings *settings) const { - settings->setFlagStr("mgcarpathian_spflags", spflags, flagdesc_mapgen_carpathian, U32_MAX); + settings->setFlagStr("mgcarpathian_spflags", spflags, flagdesc_mapgen_carpathian); settings->setFloat("mgcarpathian_base_level", base_level); settings->setFloat("mgcarpathian_river_width", river_width); @@ -227,6 +227,12 @@ void MapgenCarpathianParams::writeParams(Settings *settings) const } +void MapgenCarpathianParams::setDefaultSettings(Settings *settings) +{ + settings->setDefault("mgcarpathian_spflags", flagdesc_mapgen_carpathian, + MGCARPATHIAN_CAVERNS); +} + //////////////////////////////////////////////////////////////////////////////// diff --git a/src/mapgen/mapgen_carpathian.h b/src/mapgen/mapgen_carpathian.h index ef49df213..acd379958 100644 --- a/src/mapgen/mapgen_carpathian.h +++ b/src/mapgen/mapgen_carpathian.h @@ -37,7 +37,6 @@ struct MapgenCarpathianParams : public MapgenParams float river_depth = 24.0f; float valley_width = 0.25f; - u32 spflags = MGCARPATHIAN_CAVERNS; float cave_width = 0.09f; s16 large_cave_depth = -33; u16 small_cave_num_min = 0; @@ -74,6 +73,7 @@ struct MapgenCarpathianParams : public MapgenParams void readParams(const Settings *settings); void writeParams(Settings *settings) const; + void setDefaultSettings(Settings *settings); }; class MapgenCarpathian : public MapgenBasic diff --git a/src/mapgen/mapgen_flat.cpp b/src/mapgen/mapgen_flat.cpp index 656e7d72c..879435948 100644 --- a/src/mapgen/mapgen_flat.cpp +++ b/src/mapgen/mapgen_flat.cpp @@ -126,7 +126,7 @@ void MapgenFlatParams::readParams(const Settings *settings) void MapgenFlatParams::writeParams(Settings *settings) const { - settings->setFlagStr("mgflat_spflags", spflags, flagdesc_mapgen_flat, U32_MAX); + settings->setFlagStr("mgflat_spflags", spflags, flagdesc_mapgen_flat); settings->setS16("mgflat_ground_level", ground_level); settings->setS16("mgflat_large_cave_depth", large_cave_depth); settings->setU16("mgflat_small_cave_num_min", small_cave_num_min); @@ -150,6 +150,12 @@ void MapgenFlatParams::writeParams(Settings *settings) const } +void MapgenFlatParams::setDefaultSettings(Settings *settings) +{ + settings->setDefault("mgflat_spflags", flagdesc_mapgen_flat, 0); +} + + ///////////////////////////////////////////////////////////////// diff --git a/src/mapgen/mapgen_flat.h b/src/mapgen/mapgen_flat.h index 2ff87c0db..c314c7605 100644 --- a/src/mapgen/mapgen_flat.h +++ b/src/mapgen/mapgen_flat.h @@ -32,7 +32,6 @@ extern FlagDesc flagdesc_mapgen_flat[]; struct MapgenFlatParams : public MapgenParams { - u32 spflags = 0; s16 ground_level = 8; s16 large_cave_depth = -33; u16 small_cave_num_min = 0; @@ -59,6 +58,7 @@ struct MapgenFlatParams : public MapgenParams void readParams(const Settings *settings); void writeParams(Settings *settings) const; + void setDefaultSettings(Settings *settings); }; class MapgenFlat : public MapgenBasic diff --git a/src/mapgen/mapgen_fractal.cpp b/src/mapgen/mapgen_fractal.cpp index 1ac57cede..cabe0b850 100644 --- a/src/mapgen/mapgen_fractal.cpp +++ b/src/mapgen/mapgen_fractal.cpp @@ -139,7 +139,7 @@ void MapgenFractalParams::readParams(const Settings *settings) void MapgenFractalParams::writeParams(Settings *settings) const { - settings->setFlagStr("mgfractal_spflags", spflags, flagdesc_mapgen_fractal, U32_MAX); + settings->setFlagStr("mgfractal_spflags", spflags, flagdesc_mapgen_fractal); settings->setFloat("mgfractal_cave_width", cave_width); settings->setS16("mgfractal_large_cave_depth", large_cave_depth); settings->setU16("mgfractal_small_cave_num_min", small_cave_num_min); @@ -167,6 +167,13 @@ void MapgenFractalParams::writeParams(Settings *settings) const } +void MapgenFractalParams::setDefaultSettings(Settings *settings) +{ + settings->setDefault("mgfractal_spflags", flagdesc_mapgen_fractal, + MGFRACTAL_TERRAIN); +} + + ///////////////////////////////////////////////////////////////// diff --git a/src/mapgen/mapgen_fractal.h b/src/mapgen/mapgen_fractal.h index 0654d0360..971dfd822 100644 --- a/src/mapgen/mapgen_fractal.h +++ b/src/mapgen/mapgen_fractal.h @@ -35,7 +35,6 @@ extern FlagDesc flagdesc_mapgen_fractal[]; struct MapgenFractalParams : public MapgenParams { - u32 spflags = MGFRACTAL_TERRAIN; float cave_width = 0.09f; s16 large_cave_depth = -33; u16 small_cave_num_min = 0; @@ -66,6 +65,7 @@ struct MapgenFractalParams : public MapgenParams void readParams(const Settings *settings); void writeParams(Settings *settings) const; + void setDefaultSettings(Settings *settings); }; diff --git a/src/mapgen/mapgen_v5.cpp b/src/mapgen/mapgen_v5.cpp index c003c27d6..447fe8c50 100644 --- a/src/mapgen/mapgen_v5.cpp +++ b/src/mapgen/mapgen_v5.cpp @@ -129,7 +129,7 @@ void MapgenV5Params::readParams(const Settings *settings) void MapgenV5Params::writeParams(Settings *settings) const { - settings->setFlagStr("mgv5_spflags", spflags, flagdesc_mapgen_v5, U32_MAX); + settings->setFlagStr("mgv5_spflags", spflags, flagdesc_mapgen_v5); settings->setFloat("mgv5_cave_width", cave_width); settings->setS16("mgv5_large_cave_depth", large_cave_depth); settings->setU16("mgv5_small_cave_num_min", small_cave_num_min); @@ -154,6 +154,15 @@ void MapgenV5Params::writeParams(Settings *settings) const } +void MapgenV5Params::setDefaultSettings(Settings *settings) +{ + settings->setDefault("mgv5_spflags", flagdesc_mapgen_v5, MGV5_CAVERNS); +} + + +///////////////////////////////////////////////////////////////// + + int MapgenV5::getSpawnLevelAtPoint(v2s16 p) { diff --git a/src/mapgen/mapgen_v5.h b/src/mapgen/mapgen_v5.h index ecdcdaf41..17bc466f0 100644 --- a/src/mapgen/mapgen_v5.h +++ b/src/mapgen/mapgen_v5.h @@ -31,7 +31,6 @@ extern FlagDesc flagdesc_mapgen_v5[]; struct MapgenV5Params : public MapgenParams { - u32 spflags = MGV5_CAVERNS; float cave_width = 0.09f; s16 large_cave_depth = -256; u16 small_cave_num_min = 0; @@ -59,6 +58,7 @@ struct MapgenV5Params : public MapgenParams void readParams(const Settings *settings); void writeParams(Settings *settings) const; + void setDefaultSettings(Settings *settings); }; class MapgenV5 : public MapgenBasic diff --git a/src/mapgen/mapgen_v6.cpp b/src/mapgen/mapgen_v6.cpp index 4e876fc53..653adc8ec 100644 --- a/src/mapgen/mapgen_v6.cpp +++ b/src/mapgen/mapgen_v6.cpp @@ -190,7 +190,7 @@ void MapgenV6Params::readParams(const Settings *settings) void MapgenV6Params::writeParams(Settings *settings) const { - settings->setFlagStr("mgv6_spflags", spflags, flagdesc_mapgen_v6, U32_MAX); + settings->setFlagStr("mgv6_spflags", spflags, flagdesc_mapgen_v6); settings->setFloat("mgv6_freq_desert", freq_desert); settings->setFloat("mgv6_freq_beach", freq_beach); settings->setS16("mgv6_dungeon_ymin", dungeon_ymin); @@ -210,8 +210,16 @@ void MapgenV6Params::writeParams(Settings *settings) const } +void MapgenV6Params::setDefaultSettings(Settings *settings) +{ + settings->setDefault("mgv6_spflags", flagdesc_mapgen_v6, MGV6_JUNGLES | + MGV6_SNOWBIOMES | MGV6_TREES | MGV6_BIOMEBLEND | MGV6_MUDFLOW); +} + + //////////////////////// Some helper functions for the map generator + // Returns Y one under area minimum if not found s16 MapgenV6::find_stone_level(v2s16 p2d) { diff --git a/src/mapgen/mapgen_v6.h b/src/mapgen/mapgen_v6.h index 7d5229559..d8cdcb26f 100644 --- a/src/mapgen/mapgen_v6.h +++ b/src/mapgen/mapgen_v6.h @@ -55,8 +55,6 @@ enum BiomeV6Type struct MapgenV6Params : public MapgenParams { - u32 spflags = MGV6_JUNGLES | MGV6_SNOWBIOMES | MGV6_TREES | - MGV6_BIOMEBLEND | MGV6_MUDFLOW; float freq_desert = 0.45f; float freq_beach = 0.15f; s16 dungeon_ymin = -31000; @@ -79,6 +77,7 @@ struct MapgenV6Params : public MapgenParams { void readParams(const Settings *settings); void writeParams(Settings *settings) const; + void setDefaultSettings(Settings *settings); }; diff --git a/src/mapgen/mapgen_v7.cpp b/src/mapgen/mapgen_v7.cpp index 23cbd4e0a..325c4957a 100644 --- a/src/mapgen/mapgen_v7.cpp +++ b/src/mapgen/mapgen_v7.cpp @@ -183,7 +183,7 @@ void MapgenV7Params::readParams(const Settings *settings) void MapgenV7Params::writeParams(Settings *settings) const { - settings->setFlagStr("mgv7_spflags", spflags, flagdesc_mapgen_v7, U32_MAX); + settings->setFlagStr("mgv7_spflags", spflags, flagdesc_mapgen_v7); settings->setS16("mgv7_mount_zero_level", mount_zero_level); settings->setFloat("mgv7_cave_width", cave_width); settings->setS16("mgv7_large_cave_depth", large_cave_depth); @@ -214,6 +214,13 @@ void MapgenV7Params::writeParams(Settings *settings) const } +void MapgenV7Params::setDefaultSettings(Settings *settings) +{ + settings->setDefault("mgv7_spflags", flagdesc_mapgen_v7, + MGV7_MOUNTAINS | MGV7_RIDGES | MGV7_CAVERNS); +} + + //////////////////////////////////////////////////////////////////////////////// diff --git a/src/mapgen/mapgen_v7.h b/src/mapgen/mapgen_v7.h index 6ca39f164..0605c5c97 100644 --- a/src/mapgen/mapgen_v7.h +++ b/src/mapgen/mapgen_v7.h @@ -35,7 +35,6 @@ extern FlagDesc flagdesc_mapgen_v7[]; struct MapgenV7Params : public MapgenParams { - u32 spflags = MGV7_MOUNTAINS | MGV7_RIDGES | MGV7_CAVERNS; s16 mount_zero_level = 0; float cave_width = 0.09f; @@ -70,6 +69,7 @@ struct MapgenV7Params : public MapgenParams { void readParams(const Settings *settings); void writeParams(Settings *settings) const; + void setDefaultSettings(Settings *settings); }; diff --git a/src/mapgen/mapgen_valleys.cpp b/src/mapgen/mapgen_valleys.cpp index 3c6045105..2b8703fa5 100644 --- a/src/mapgen/mapgen_valleys.cpp +++ b/src/mapgen/mapgen_valleys.cpp @@ -162,7 +162,7 @@ void MapgenValleysParams::readParams(const Settings *settings) void MapgenValleysParams::writeParams(Settings *settings) const { - settings->setFlagStr("mgvalleys_spflags", spflags, flagdesc_mapgen_valleys, U32_MAX); + settings->setFlagStr("mgvalleys_spflags", spflags, flagdesc_mapgen_valleys); settings->setU16("mgvalleys_altitude_chill", altitude_chill); settings->setS16("mgvalleys_large_cave_depth", large_cave_depth); settings->setU16("mgvalleys_small_cave_num_min", small_cave_num_min); @@ -194,6 +194,17 @@ void MapgenValleysParams::writeParams(Settings *settings) const } +void MapgenValleysParams::setDefaultSettings(Settings *settings) +{ + settings->setDefault("mgvalleys_spflags", flagdesc_mapgen_valleys, + MGVALLEYS_ALT_CHILL | MGVALLEYS_HUMID_RIVERS | + MGVALLEYS_VARY_RIVER_DEPTH | MGVALLEYS_ALT_DRY); +} + + +///////////////////////////////////////////////////////////////// + + void MapgenValleys::makeChunk(BlockMakeData *data) { // Pre-conditions diff --git a/src/mapgen/mapgen_valleys.h b/src/mapgen/mapgen_valleys.h index be97f0763..1aec68842 100644 --- a/src/mapgen/mapgen_valleys.h +++ b/src/mapgen/mapgen_valleys.h @@ -41,8 +41,6 @@ extern FlagDesc flagdesc_mapgen_valleys[]; struct MapgenValleysParams : public MapgenParams { - u32 spflags = MGVALLEYS_ALT_CHILL | MGVALLEYS_HUMID_RIVERS | - MGVALLEYS_VARY_RIVER_DEPTH | MGVALLEYS_ALT_DRY; u16 altitude_chill = 90; u16 river_depth = 4; u16 river_size = 5; @@ -78,6 +76,7 @@ struct MapgenValleysParams : public MapgenParams { void readParams(const Settings *settings); void writeParams(Settings *settings) const; + void setDefaultSettings(Settings *settings); }; |