forked from Mirrorlandia_minetest/minetest
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
This commit is contained in:
parent
b3716a03a6
commit
b55fc3d773
@ -174,8 +174,8 @@ MapgenParams *MapSettingsManager::makeMapgenParams()
|
|||||||
|
|
||||||
// Create our MapgenParams
|
// Create our MapgenParams
|
||||||
MapgenParams *params = Mapgen::createMapgenParams(mgtype);
|
MapgenParams *params = Mapgen::createMapgenParams(mgtype);
|
||||||
if (params == NULL)
|
if (!params)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
params->mgtype = mgtype;
|
params->mgtype = mgtype;
|
||||||
|
|
||||||
|
@ -153,23 +153,23 @@ Mapgen *Mapgen::createMapgen(MapgenType mgtype, int mgid,
|
|||||||
{
|
{
|
||||||
switch (mgtype) {
|
switch (mgtype) {
|
||||||
case MAPGEN_CARPATHIAN:
|
case MAPGEN_CARPATHIAN:
|
||||||
return new MapgenCarpathian(mgid, (MapgenCarpathianParams *)params, emerge);
|
return new MapgenCarpathian((MapgenCarpathianParams *)params, emerge);
|
||||||
case MAPGEN_FLAT:
|
case MAPGEN_FLAT:
|
||||||
return new MapgenFlat(mgid, (MapgenFlatParams *)params, emerge);
|
return new MapgenFlat((MapgenFlatParams *)params, emerge);
|
||||||
case MAPGEN_FRACTAL:
|
case MAPGEN_FRACTAL:
|
||||||
return new MapgenFractal(mgid, (MapgenFractalParams *)params, emerge);
|
return new MapgenFractal((MapgenFractalParams *)params, emerge);
|
||||||
case MAPGEN_SINGLENODE:
|
case MAPGEN_SINGLENODE:
|
||||||
return new MapgenSinglenode(mgid, (MapgenSinglenodeParams *)params, emerge);
|
return new MapgenSinglenode((MapgenSinglenodeParams *)params, emerge);
|
||||||
case MAPGEN_V5:
|
case MAPGEN_V5:
|
||||||
return new MapgenV5(mgid, (MapgenV5Params *)params, emerge);
|
return new MapgenV5((MapgenV5Params *)params, emerge);
|
||||||
case MAPGEN_V6:
|
case MAPGEN_V6:
|
||||||
return new MapgenV6(mgid, (MapgenV6Params *)params, emerge);
|
return new MapgenV6((MapgenV6Params *)params, emerge);
|
||||||
case MAPGEN_V7:
|
case MAPGEN_V7:
|
||||||
return new MapgenV7(mgid, (MapgenV7Params *)params, emerge);
|
return new MapgenV7((MapgenV7Params *)params, emerge);
|
||||||
case MAPGEN_VALLEYS:
|
case MAPGEN_VALLEYS:
|
||||||
return new MapgenValleys(mgid, (MapgenValleysParams *)params, emerge);
|
return new MapgenValleys((MapgenValleysParams *)params, emerge);
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ MapgenParams *Mapgen::createMapgenParams(MapgenType mgtype)
|
|||||||
case MAPGEN_VALLEYS:
|
case MAPGEN_VALLEYS:
|
||||||
return new MapgenValleysParams;
|
return new MapgenValleysParams;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,9 +50,8 @@ FlagDesc flagdesc_mapgen_carpathian[] = {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
MapgenCarpathian::MapgenCarpathian(
|
MapgenCarpathian::MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager *emerge)
|
||||||
int mapgenid, MapgenCarpathianParams *params, EmergeManager *emerge)
|
: MapgenBasic(MAPGEN_CARPATHIAN, params, emerge)
|
||||||
: MapgenBasic(mapgenid, params, emerge)
|
|
||||||
{
|
{
|
||||||
base_level = params->base_level;
|
base_level = params->base_level;
|
||||||
|
|
||||||
|
@ -71,8 +71,7 @@ struct MapgenCarpathianParams : public MapgenParams
|
|||||||
class MapgenCarpathian : public MapgenBasic
|
class MapgenCarpathian : public MapgenBasic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MapgenCarpathian(int mapgenid, MapgenCarpathianParams *params,
|
MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager *emerge);
|
||||||
EmergeManager *emerge);
|
|
||||||
~MapgenCarpathian();
|
~MapgenCarpathian();
|
||||||
|
|
||||||
virtual MapgenType getType() const { return MAPGEN_CARPATHIAN; }
|
virtual MapgenType getType() const { return MAPGEN_CARPATHIAN; }
|
||||||
|
@ -48,8 +48,8 @@ FlagDesc flagdesc_mapgen_flat[] = {
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
MapgenFlat::MapgenFlat(int mapgenid, MapgenFlatParams *params, EmergeManager *emerge)
|
MapgenFlat::MapgenFlat(MapgenFlatParams *params, EmergeManager *emerge)
|
||||||
: MapgenBasic(mapgenid, params, emerge)
|
: MapgenBasic(MAPGEN_FLAT, params, emerge)
|
||||||
{
|
{
|
||||||
spflags = params->spflags;
|
spflags = params->spflags;
|
||||||
ground_level = params->ground_level;
|
ground_level = params->ground_level;
|
||||||
|
@ -59,7 +59,7 @@ struct MapgenFlatParams : public MapgenParams
|
|||||||
class MapgenFlat : public MapgenBasic
|
class MapgenFlat : public MapgenBasic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MapgenFlat(int mapgenid, MapgenFlatParams *params, EmergeManager *emerge);
|
MapgenFlat(MapgenFlatParams *params, EmergeManager *emerge);
|
||||||
~MapgenFlat();
|
~MapgenFlat();
|
||||||
|
|
||||||
virtual MapgenType getType() const { return MAPGEN_FLAT; }
|
virtual MapgenType getType() const { return MAPGEN_FLAT; }
|
||||||
|
@ -47,8 +47,8 @@ FlagDesc flagdesc_mapgen_fractal[] = {
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
MapgenFractal::MapgenFractal(int mapgenid, MapgenFractalParams *params, EmergeManager *emerge)
|
MapgenFractal::MapgenFractal(MapgenFractalParams *params, EmergeManager *emerge)
|
||||||
: MapgenBasic(mapgenid, params, emerge)
|
: MapgenBasic(MAPGEN_FRACTAL, params, emerge)
|
||||||
{
|
{
|
||||||
spflags = params->spflags;
|
spflags = params->spflags;
|
||||||
cave_width = params->cave_width;
|
cave_width = params->cave_width;
|
||||||
|
@ -62,7 +62,7 @@ struct MapgenFractalParams : public MapgenParams
|
|||||||
class MapgenFractal : public MapgenBasic
|
class MapgenFractal : public MapgenBasic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MapgenFractal(int mapgenid, MapgenFractalParams *params, EmergeManager *emerge);
|
MapgenFractal(MapgenFractalParams *params, EmergeManager *emerge);
|
||||||
~MapgenFractal();
|
~MapgenFractal();
|
||||||
|
|
||||||
virtual MapgenType getType() const { return MAPGEN_FRACTAL; }
|
virtual MapgenType getType() const { return MAPGEN_FRACTAL; }
|
||||||
|
@ -29,9 +29,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "emerge.h"
|
#include "emerge.h"
|
||||||
|
|
||||||
|
|
||||||
MapgenSinglenode::MapgenSinglenode(int mapgenid,
|
MapgenSinglenode::MapgenSinglenode(MapgenParams *params, EmergeManager *emerge)
|
||||||
MapgenParams *params, EmergeManager *emerge)
|
: Mapgen(MAPGEN_SINGLENODE, params, emerge)
|
||||||
: Mapgen(mapgenid, params, emerge)
|
|
||||||
{
|
{
|
||||||
const NodeDefManager *ndef = emerge->ndef;
|
const NodeDefManager *ndef = emerge->ndef;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public:
|
|||||||
content_t c_node;
|
content_t c_node;
|
||||||
u8 set_light;
|
u8 set_light;
|
||||||
|
|
||||||
MapgenSinglenode(int mapgenid, MapgenParams *params, EmergeManager *emerge);
|
MapgenSinglenode(MapgenParams *params, EmergeManager *emerge);
|
||||||
~MapgenSinglenode() = default;
|
~MapgenSinglenode() = default;
|
||||||
|
|
||||||
virtual MapgenType getType() const { return MAPGEN_SINGLENODE; }
|
virtual MapgenType getType() const { return MAPGEN_SINGLENODE; }
|
||||||
|
@ -45,8 +45,8 @@ FlagDesc flagdesc_mapgen_v5[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
MapgenV5::MapgenV5(int mapgenid, MapgenV5Params *params, EmergeManager *emerge)
|
MapgenV5::MapgenV5(MapgenV5Params *params, EmergeManager *emerge)
|
||||||
: MapgenBasic(mapgenid, params, emerge)
|
: MapgenBasic(MAPGEN_V5, params, emerge)
|
||||||
{
|
{
|
||||||
spflags = params->spflags;
|
spflags = params->spflags;
|
||||||
cave_width = params->cave_width;
|
cave_width = params->cave_width;
|
||||||
|
@ -59,7 +59,7 @@ struct MapgenV5Params : public MapgenParams
|
|||||||
class MapgenV5 : public MapgenBasic
|
class MapgenV5 : public MapgenBasic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MapgenV5(int mapgenid, MapgenV5Params *params, EmergeManager *emerge);
|
MapgenV5(MapgenV5Params *params, EmergeManager *emerge);
|
||||||
~MapgenV5();
|
~MapgenV5();
|
||||||
|
|
||||||
virtual MapgenType getType() const { return MAPGEN_V5; }
|
virtual MapgenType getType() const { return MAPGEN_V5; }
|
||||||
|
@ -55,8 +55,8 @@ FlagDesc flagdesc_mapgen_v6[] = {
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
MapgenV6::MapgenV6(int mapgenid, MapgenV6Params *params, EmergeManager *emerge)
|
MapgenV6::MapgenV6(MapgenV6Params *params, EmergeManager *emerge)
|
||||||
: Mapgen(mapgenid, params, emerge)
|
: Mapgen(MAPGEN_V6, params, emerge)
|
||||||
{
|
{
|
||||||
m_emerge = emerge;
|
m_emerge = emerge;
|
||||||
ystride = csize.X; //////fix this
|
ystride = csize.X; //////fix this
|
||||||
|
@ -132,7 +132,7 @@ public:
|
|||||||
content_t c_stair_cobble;
|
content_t c_stair_cobble;
|
||||||
content_t c_stair_desert_stone;
|
content_t c_stair_desert_stone;
|
||||||
|
|
||||||
MapgenV6(int mapgenid, MapgenV6Params *params, EmergeManager *emerge);
|
MapgenV6(MapgenV6Params *params, EmergeManager *emerge);
|
||||||
~MapgenV6();
|
~MapgenV6();
|
||||||
|
|
||||||
virtual MapgenType getType() const { return MAPGEN_V6; }
|
virtual MapgenType getType() const { return MAPGEN_V6; }
|
||||||
|
@ -52,8 +52,8 @@ FlagDesc flagdesc_mapgen_v7[] = {
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
MapgenV7::MapgenV7(int mapgenid, MapgenV7Params *params, EmergeManager *emerge)
|
MapgenV7::MapgenV7(MapgenV7Params *params, EmergeManager *emerge)
|
||||||
: MapgenBasic(mapgenid, params, emerge)
|
: MapgenBasic(MAPGEN_V7, params, emerge)
|
||||||
{
|
{
|
||||||
spflags = params->spflags;
|
spflags = params->spflags;
|
||||||
mount_zero_level = params->mount_zero_level;
|
mount_zero_level = params->mount_zero_level;
|
||||||
|
@ -77,7 +77,7 @@ struct MapgenV7Params : public MapgenParams {
|
|||||||
|
|
||||||
class MapgenV7 : public MapgenBasic {
|
class MapgenV7 : public MapgenBasic {
|
||||||
public:
|
public:
|
||||||
MapgenV7(int mapgenid, MapgenV7Params *params, EmergeManager *emerge);
|
MapgenV7(MapgenV7Params *params, EmergeManager *emerge);
|
||||||
~MapgenV7();
|
~MapgenV7();
|
||||||
|
|
||||||
virtual MapgenType getType() const { return MAPGEN_V7; }
|
virtual MapgenType getType() const { return MAPGEN_V7; }
|
||||||
|
@ -54,9 +54,8 @@ FlagDesc flagdesc_mapgen_valleys[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
MapgenValleys::MapgenValleys(int mapgenid, MapgenValleysParams *params,
|
MapgenValleys::MapgenValleys(MapgenValleysParams *params, EmergeManager *emerge)
|
||||||
EmergeManager *emerge)
|
: MapgenBasic(MAPGEN_VALLEYS, params, emerge)
|
||||||
: MapgenBasic(mapgenid, params, emerge)
|
|
||||||
{
|
{
|
||||||
// NOTE: MapgenValleys has a hard dependency on BiomeGenOriginal
|
// NOTE: MapgenValleys has a hard dependency on BiomeGenOriginal
|
||||||
m_bgen = (BiomeGenOriginal *)biomegen;
|
m_bgen = (BiomeGenOriginal *)biomegen;
|
||||||
|
@ -79,7 +79,7 @@ struct MapgenValleysParams : public MapgenParams {
|
|||||||
class MapgenValleys : public MapgenBasic {
|
class MapgenValleys : public MapgenBasic {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MapgenValleys(int mapgenid, MapgenValleysParams *params,
|
MapgenValleys(MapgenValleysParams *params,
|
||||||
EmergeManager *emerge);
|
EmergeManager *emerge);
|
||||||
~MapgenValleys();
|
~MapgenValleys();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user