mirror of
https://github.com/minetest/minetest.git
synced 2024-12-27 16:37:30 +01:00
Refactor EmergeParams owner
This commit is contained in:
parent
32ff832108
commit
20b10b5691
@ -131,9 +131,15 @@ Mapgen::Mapgen(int mapgenid, MapgenParams *params, EmergeParams *emerge) :
|
||||
*/
|
||||
seed = (s32)params->seed;
|
||||
|
||||
m_emerge = emerge;
|
||||
ndef = emerge->ndef;
|
||||
}
|
||||
|
||||
Mapgen::~Mapgen()
|
||||
{
|
||||
delete m_emerge; // this is our responsibility
|
||||
}
|
||||
|
||||
|
||||
MapgenType Mapgen::getMapgenType(const std::string &mgname)
|
||||
{
|
||||
@ -566,7 +572,6 @@ void Mapgen::spreadLight(const v3s16 &nmin, const v3s16 &nmax)
|
||||
MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeParams *emerge)
|
||||
: Mapgen(mapgenid, params, emerge)
|
||||
{
|
||||
this->m_emerge = emerge;
|
||||
this->m_bmgr = emerge->biomemgr;
|
||||
|
||||
//// Here, 'stride' refers to the number of elements needed to skip to index
|
||||
@ -620,8 +625,6 @@ MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeParams *emerg
|
||||
MapgenBasic::~MapgenBasic()
|
||||
{
|
||||
delete []heightmap;
|
||||
|
||||
delete m_emerge; // destroying EmergeParams is our responsibility
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,6 +163,9 @@ public:
|
||||
int id = -1;
|
||||
|
||||
MMVManip *vm = nullptr;
|
||||
// Note that this contains various things the mapgens *can* use, so biomegen
|
||||
// might be NULL while m_emerge->biomegen is not.
|
||||
EmergeParams *m_emerge = nullptr;
|
||||
const NodeDefManager *ndef = nullptr;
|
||||
|
||||
u32 blockseed;
|
||||
@ -175,7 +178,7 @@ public:
|
||||
|
||||
Mapgen() = default;
|
||||
Mapgen(int mapgenid, MapgenParams *params, EmergeParams *emerge);
|
||||
virtual ~Mapgen() = default;
|
||||
virtual ~Mapgen();
|
||||
DISABLE_CLASS_COPY(Mapgen);
|
||||
|
||||
virtual MapgenType getType() const { return MAPGEN_INVALID; }
|
||||
@ -289,7 +292,6 @@ public:
|
||||
virtual void generateDungeons(s16 max_stone_y);
|
||||
|
||||
protected:
|
||||
EmergeParams *m_emerge;
|
||||
BiomeManager *m_bmgr;
|
||||
|
||||
Noise *noise_filler_depth;
|
||||
|
@ -32,8 +32,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
MapgenSinglenode::MapgenSinglenode(MapgenParams *params, EmergeParams *emerge)
|
||||
: Mapgen(MAPGEN_SINGLENODE, params, emerge)
|
||||
{
|
||||
const NodeDefManager *ndef = emerge->ndef;
|
||||
|
||||
c_node = ndef->getId("mapgen_singlenode");
|
||||
if (c_node == CONTENT_IGNORE)
|
||||
c_node = CONTENT_AIR;
|
||||
|
@ -57,7 +57,6 @@ FlagDesc flagdesc_mapgen_v6[] = {
|
||||
MapgenV6::MapgenV6(MapgenV6Params *params, EmergeParams *emerge)
|
||||
: Mapgen(MAPGEN_V6, params, emerge)
|
||||
{
|
||||
m_emerge = emerge;
|
||||
ystride = csize.X;
|
||||
|
||||
heightmap = new s16[csize.X * csize.Z];
|
||||
@ -160,8 +159,6 @@ MapgenV6::~MapgenV6()
|
||||
delete noise_humidity;
|
||||
|
||||
delete[] heightmap;
|
||||
|
||||
delete m_emerge; // our responsibility
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user