diff options
author | Loïc Blot <loic.blot@unix-experience.fr> | 2019-03-25 16:42:53 +0100 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2019-03-31 20:49:39 +0200 |
commit | b55fc3d773e2049d99a01ea2aa4e37774e81410b (patch) | |
tree | 13215d9ff90bca74542984e7f7726b70bca69829 /src/mapgen | |
parent | b3716a03a6d47058b50acfc71c861ecfea5f80ad (diff) | |
download | minetest-b55fc3d773e2049d99a01ea2aa4e37774e81410b.tar.gz minetest-b55fc3d773e2049d99a01ea2aa4e37774e81410b.tar.bz2 minetest-b55fc3d773e2049d99a01ea2aa4e37774e81410b.zip |
mapgen: drop mapgen id from child mapgens.
This id must be owned by the child mapgen and never be set to a misc value by a developer
Also use nullptr in some places
Diffstat (limited to 'src/mapgen')
-rw-r--r-- | src/mapgen/mapgen.cpp | 20 | ||||
-rw-r--r-- | src/mapgen/mapgen_carpathian.cpp | 5 | ||||
-rw-r--r-- | src/mapgen/mapgen_carpathian.h | 3 | ||||
-rw-r--r-- | src/mapgen/mapgen_flat.cpp | 4 | ||||
-rw-r--r-- | src/mapgen/mapgen_flat.h | 2 | ||||
-rw-r--r-- | src/mapgen/mapgen_fractal.cpp | 4 | ||||
-rw-r--r-- | src/mapgen/mapgen_fractal.h | 2 | ||||
-rw-r--r-- | src/mapgen/mapgen_singlenode.cpp | 5 | ||||
-rw-r--r-- | src/mapgen/mapgen_singlenode.h | 2 | ||||
-rw-r--r-- | src/mapgen/mapgen_v5.cpp | 4 | ||||
-rw-r--r-- | src/mapgen/mapgen_v5.h | 2 | ||||
-rw-r--r-- | src/mapgen/mapgen_v6.cpp | 4 | ||||
-rw-r--r-- | src/mapgen/mapgen_v6.h | 2 | ||||
-rw-r--r-- | src/mapgen/mapgen_v7.cpp | 4 | ||||
-rw-r--r-- | src/mapgen/mapgen_v7.h | 2 | ||||
-rw-r--r-- | src/mapgen/mapgen_valleys.cpp | 5 | ||||
-rw-r--r-- | src/mapgen/mapgen_valleys.h | 2 |
17 files changed, 34 insertions, 38 deletions
diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp index 7de367a27..c46ff7c83 100644 --- a/src/mapgen/mapgen.cpp +++ b/src/mapgen/mapgen.cpp @@ -153,23 +153,23 @@ Mapgen *Mapgen::createMapgen(MapgenType mgtype, int mgid, { switch (mgtype) { case MAPGEN_CARPATHIAN: - return new MapgenCarpathian(mgid, (MapgenCarpathianParams *)params, emerge); + return new MapgenCarpathian((MapgenCarpathianParams *)params, emerge); case MAPGEN_FLAT: - return new MapgenFlat(mgid, (MapgenFlatParams *)params, emerge); + return new MapgenFlat((MapgenFlatParams *)params, emerge); case MAPGEN_FRACTAL: - return new MapgenFractal(mgid, (MapgenFractalParams *)params, emerge); + return new MapgenFractal((MapgenFractalParams *)params, emerge); case MAPGEN_SINGLENODE: - return new MapgenSinglenode(mgid, (MapgenSinglenodeParams *)params, emerge); + return new MapgenSinglenode((MapgenSinglenodeParams *)params, emerge); case MAPGEN_V5: - return new MapgenV5(mgid, (MapgenV5Params *)params, emerge); + return new MapgenV5((MapgenV5Params *)params, emerge); case MAPGEN_V6: - return new MapgenV6(mgid, (MapgenV6Params *)params, emerge); + return new MapgenV6((MapgenV6Params *)params, emerge); case MAPGEN_V7: - return new MapgenV7(mgid, (MapgenV7Params *)params, emerge); + return new MapgenV7((MapgenV7Params *)params, emerge); case MAPGEN_VALLEYS: - return new MapgenValleys(mgid, (MapgenValleysParams *)params, emerge); + return new MapgenValleys((MapgenValleysParams *)params, emerge); default: - return NULL; + return nullptr; } } @@ -194,7 +194,7 @@ MapgenParams *Mapgen::createMapgenParams(MapgenType mgtype) case MAPGEN_VALLEYS: return new MapgenValleysParams; default: - return NULL; + return nullptr; } } diff --git a/src/mapgen/mapgen_carpathian.cpp b/src/mapgen/mapgen_carpathian.cpp index f7daef708..3a69fb5b8 100644 --- a/src/mapgen/mapgen_carpathian.cpp +++ b/src/mapgen/mapgen_carpathian.cpp @@ -50,9 +50,8 @@ FlagDesc flagdesc_mapgen_carpathian[] = { /////////////////////////////////////////////////////////////////////////////// -MapgenCarpathian::MapgenCarpathian( - int mapgenid, MapgenCarpathianParams *params, EmergeManager *emerge) - : MapgenBasic(mapgenid, params, emerge) +MapgenCarpathian::MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager *emerge) + : MapgenBasic(MAPGEN_CARPATHIAN, params, emerge) { base_level = params->base_level; diff --git a/src/mapgen/mapgen_carpathian.h b/src/mapgen/mapgen_carpathian.h index c32212c9a..3f61b7d22 100644 --- a/src/mapgen/mapgen_carpathian.h +++ b/src/mapgen/mapgen_carpathian.h @@ -71,8 +71,7 @@ struct MapgenCarpathianParams : public MapgenParams class MapgenCarpathian : public MapgenBasic { public: - MapgenCarpathian(int mapgenid, MapgenCarpathianParams *params, - EmergeManager *emerge); + MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager *emerge); ~MapgenCarpathian(); virtual MapgenType getType() const { return MAPGEN_CARPATHIAN; } diff --git a/src/mapgen/mapgen_flat.cpp b/src/mapgen/mapgen_flat.cpp index 11b27f85c..e31dc4703 100644 --- a/src/mapgen/mapgen_flat.cpp +++ b/src/mapgen/mapgen_flat.cpp @@ -48,8 +48,8 @@ FlagDesc flagdesc_mapgen_flat[] = { /////////////////////////////////////////////////////////////////////////////////////// -MapgenFlat::MapgenFlat(int mapgenid, MapgenFlatParams *params, EmergeManager *emerge) - : MapgenBasic(mapgenid, params, emerge) +MapgenFlat::MapgenFlat(MapgenFlatParams *params, EmergeManager *emerge) + : MapgenBasic(MAPGEN_FLAT, params, emerge) { spflags = params->spflags; ground_level = params->ground_level; diff --git a/src/mapgen/mapgen_flat.h b/src/mapgen/mapgen_flat.h index d8ec9f126..e9bd611e4 100644 --- a/src/mapgen/mapgen_flat.h +++ b/src/mapgen/mapgen_flat.h @@ -59,7 +59,7 @@ struct MapgenFlatParams : public MapgenParams class MapgenFlat : public MapgenBasic { public: - MapgenFlat(int mapgenid, MapgenFlatParams *params, EmergeManager *emerge); + MapgenFlat(MapgenFlatParams *params, EmergeManager *emerge); ~MapgenFlat(); virtual MapgenType getType() const { return MAPGEN_FLAT; } diff --git a/src/mapgen/mapgen_fractal.cpp b/src/mapgen/mapgen_fractal.cpp index 68a66bba9..47699b8a2 100644 --- a/src/mapgen/mapgen_fractal.cpp +++ b/src/mapgen/mapgen_fractal.cpp @@ -47,8 +47,8 @@ FlagDesc flagdesc_mapgen_fractal[] = { /////////////////////////////////////////////////////////////////////////////////////// -MapgenFractal::MapgenFractal(int mapgenid, MapgenFractalParams *params, EmergeManager *emerge) - : MapgenBasic(mapgenid, params, emerge) +MapgenFractal::MapgenFractal(MapgenFractalParams *params, EmergeManager *emerge) + : MapgenBasic(MAPGEN_FRACTAL, params, emerge) { spflags = params->spflags; cave_width = params->cave_width; diff --git a/src/mapgen/mapgen_fractal.h b/src/mapgen/mapgen_fractal.h index 5a1948b9a..da250c1e9 100644 --- a/src/mapgen/mapgen_fractal.h +++ b/src/mapgen/mapgen_fractal.h @@ -62,7 +62,7 @@ struct MapgenFractalParams : public MapgenParams class MapgenFractal : public MapgenBasic { public: - MapgenFractal(int mapgenid, MapgenFractalParams *params, EmergeManager *emerge); + MapgenFractal(MapgenFractalParams *params, EmergeManager *emerge); ~MapgenFractal(); virtual MapgenType getType() const { return MAPGEN_FRACTAL; } diff --git a/src/mapgen/mapgen_singlenode.cpp b/src/mapgen/mapgen_singlenode.cpp index 76f7e6e8e..b64524e1c 100644 --- a/src/mapgen/mapgen_singlenode.cpp +++ b/src/mapgen/mapgen_singlenode.cpp @@ -29,9 +29,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "emerge.h" -MapgenSinglenode::MapgenSinglenode(int mapgenid, - MapgenParams *params, EmergeManager *emerge) - : Mapgen(mapgenid, params, emerge) +MapgenSinglenode::MapgenSinglenode(MapgenParams *params, EmergeManager *emerge) + : Mapgen(MAPGEN_SINGLENODE, params, emerge) { const NodeDefManager *ndef = emerge->ndef; diff --git a/src/mapgen/mapgen_singlenode.h b/src/mapgen/mapgen_singlenode.h index ebfb3c729..c21089eda 100644 --- a/src/mapgen/mapgen_singlenode.h +++ b/src/mapgen/mapgen_singlenode.h @@ -38,7 +38,7 @@ public: content_t c_node; u8 set_light; - MapgenSinglenode(int mapgenid, MapgenParams *params, EmergeManager *emerge); + MapgenSinglenode(MapgenParams *params, EmergeManager *emerge); ~MapgenSinglenode() = default; virtual MapgenType getType() const { return MAPGEN_SINGLENODE; } diff --git a/src/mapgen/mapgen_v5.cpp b/src/mapgen/mapgen_v5.cpp index c5be727b9..eded332ca 100644 --- a/src/mapgen/mapgen_v5.cpp +++ b/src/mapgen/mapgen_v5.cpp @@ -45,8 +45,8 @@ FlagDesc flagdesc_mapgen_v5[] = { }; -MapgenV5::MapgenV5(int mapgenid, MapgenV5Params *params, EmergeManager *emerge) - : MapgenBasic(mapgenid, params, emerge) +MapgenV5::MapgenV5(MapgenV5Params *params, EmergeManager *emerge) + : MapgenBasic(MAPGEN_V5, params, emerge) { spflags = params->spflags; cave_width = params->cave_width; diff --git a/src/mapgen/mapgen_v5.h b/src/mapgen/mapgen_v5.h index a1b56a070..023d8308d 100644 --- a/src/mapgen/mapgen_v5.h +++ b/src/mapgen/mapgen_v5.h @@ -59,7 +59,7 @@ struct MapgenV5Params : public MapgenParams class MapgenV5 : public MapgenBasic { public: - MapgenV5(int mapgenid, MapgenV5Params *params, EmergeManager *emerge); + MapgenV5(MapgenV5Params *params, EmergeManager *emerge); ~MapgenV5(); virtual MapgenType getType() const { return MAPGEN_V5; } diff --git a/src/mapgen/mapgen_v6.cpp b/src/mapgen/mapgen_v6.cpp index fdfebe575..2b73c2975 100644 --- a/src/mapgen/mapgen_v6.cpp +++ b/src/mapgen/mapgen_v6.cpp @@ -55,8 +55,8 @@ FlagDesc flagdesc_mapgen_v6[] = { ///////////////////////////////////////////////////////////////////////////// -MapgenV6::MapgenV6(int mapgenid, MapgenV6Params *params, EmergeManager *emerge) - : Mapgen(mapgenid, params, emerge) +MapgenV6::MapgenV6(MapgenV6Params *params, EmergeManager *emerge) + : Mapgen(MAPGEN_V6, params, emerge) { m_emerge = emerge; ystride = csize.X; //////fix this diff --git a/src/mapgen/mapgen_v6.h b/src/mapgen/mapgen_v6.h index 056281f2f..842057903 100644 --- a/src/mapgen/mapgen_v6.h +++ b/src/mapgen/mapgen_v6.h @@ -132,7 +132,7 @@ public: content_t c_stair_cobble; content_t c_stair_desert_stone; - MapgenV6(int mapgenid, MapgenV6Params *params, EmergeManager *emerge); + MapgenV6(MapgenV6Params *params, EmergeManager *emerge); ~MapgenV6(); virtual MapgenType getType() const { return MAPGEN_V6; } diff --git a/src/mapgen/mapgen_v7.cpp b/src/mapgen/mapgen_v7.cpp index 1354bf256..ad5220925 100644 --- a/src/mapgen/mapgen_v7.cpp +++ b/src/mapgen/mapgen_v7.cpp @@ -52,8 +52,8 @@ FlagDesc flagdesc_mapgen_v7[] = { //////////////////////////////////////////////////////////////////////////////// -MapgenV7::MapgenV7(int mapgenid, MapgenV7Params *params, EmergeManager *emerge) - : MapgenBasic(mapgenid, params, emerge) +MapgenV7::MapgenV7(MapgenV7Params *params, EmergeManager *emerge) + : MapgenBasic(MAPGEN_V7, params, emerge) { spflags = params->spflags; mount_zero_level = params->mount_zero_level; diff --git a/src/mapgen/mapgen_v7.h b/src/mapgen/mapgen_v7.h index b55c80d3a..f61da2b79 100644 --- a/src/mapgen/mapgen_v7.h +++ b/src/mapgen/mapgen_v7.h @@ -77,7 +77,7 @@ struct MapgenV7Params : public MapgenParams { class MapgenV7 : public MapgenBasic { public: - MapgenV7(int mapgenid, MapgenV7Params *params, EmergeManager *emerge); + MapgenV7(MapgenV7Params *params, EmergeManager *emerge); ~MapgenV7(); virtual MapgenType getType() const { return MAPGEN_V7; } diff --git a/src/mapgen/mapgen_valleys.cpp b/src/mapgen/mapgen_valleys.cpp index a27a31201..b8eb5b5f9 100644 --- a/src/mapgen/mapgen_valleys.cpp +++ b/src/mapgen/mapgen_valleys.cpp @@ -54,9 +54,8 @@ FlagDesc flagdesc_mapgen_valleys[] = { }; -MapgenValleys::MapgenValleys(int mapgenid, MapgenValleysParams *params, - EmergeManager *emerge) - : MapgenBasic(mapgenid, params, emerge) +MapgenValleys::MapgenValleys(MapgenValleysParams *params, EmergeManager *emerge) + : MapgenBasic(MAPGEN_VALLEYS, params, emerge) { // NOTE: MapgenValleys has a hard dependency on BiomeGenOriginal m_bgen = (BiomeGenOriginal *)biomegen; diff --git a/src/mapgen/mapgen_valleys.h b/src/mapgen/mapgen_valleys.h index 06920a477..fd40b5bab 100644 --- a/src/mapgen/mapgen_valleys.h +++ b/src/mapgen/mapgen_valleys.h @@ -79,7 +79,7 @@ struct MapgenValleysParams : public MapgenParams { class MapgenValleys : public MapgenBasic { public: - MapgenValleys(int mapgenid, MapgenValleysParams *params, + MapgenValleys(MapgenValleysParams *params, EmergeManager *emerge); ~MapgenValleys(); |