forked from Mirrorlandia_minetest/minetest
Give the Mapgen on each EmergeThread its own Biome/Ore/Deco/SchemManager copy
This commit is contained in:
parent
2062c80e21
commit
3c65d1acec
@ -109,6 +109,28 @@ private:
|
|||||||
VoxelArea *m_ignorevariable;
|
VoxelArea *m_ignorevariable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EmergeParams::~EmergeParams()
|
||||||
|
{
|
||||||
|
infostream << "EmergeParams: destroying " << this << std::endl;
|
||||||
|
// Delete everything that was cloned on creation of EmergeParams
|
||||||
|
delete biomemgr;
|
||||||
|
delete oremgr;
|
||||||
|
delete decomgr;
|
||||||
|
delete schemmgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
EmergeParams::EmergeParams(EmergeManager *parent, const BiomeManager *biomemgr,
|
||||||
|
const OreManager *oremgr, const DecorationManager *decomgr,
|
||||||
|
const SchematicManager *schemmgr) :
|
||||||
|
ndef(parent->ndef),
|
||||||
|
enable_mapgen_debug_info(parent->enable_mapgen_debug_info),
|
||||||
|
gen_notify_on(parent->gen_notify_on),
|
||||||
|
gen_notify_on_deco_ids(&parent->gen_notify_on_deco_ids),
|
||||||
|
biomemgr(biomemgr->clone()), oremgr(oremgr->clone()),
|
||||||
|
decomgr(decomgr->clone()), schemmgr(schemmgr->clone())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
////
|
////
|
||||||
//// EmergeManager
|
//// EmergeManager
|
||||||
////
|
////
|
||||||
@ -182,14 +204,48 @@ EmergeManager::~EmergeManager()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BiomeManager *EmergeManager::getWritableBiomeManager()
|
||||||
|
{
|
||||||
|
FATAL_ERROR_IF(!m_mapgens.empty(),
|
||||||
|
"Writable managers can only be returned before mapgen init");
|
||||||
|
return biomemgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
OreManager *EmergeManager::getWritableOreManager()
|
||||||
|
{
|
||||||
|
FATAL_ERROR_IF(!m_mapgens.empty(),
|
||||||
|
"Writable managers can only be returned before mapgen init");
|
||||||
|
return oremgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
DecorationManager *EmergeManager::getWritableDecorationManager()
|
||||||
|
{
|
||||||
|
FATAL_ERROR_IF(!m_mapgens.empty(),
|
||||||
|
"Writable managers can only be returned before mapgen init");
|
||||||
|
return decomgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
SchematicManager *EmergeManager::getWritableSchematicManager()
|
||||||
|
{
|
||||||
|
FATAL_ERROR_IF(!m_mapgens.empty(),
|
||||||
|
"Writable managers can only be returned before mapgen init");
|
||||||
|
return schemmgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void EmergeManager::initMapgens(MapgenParams *params)
|
void EmergeManager::initMapgens(MapgenParams *params)
|
||||||
{
|
{
|
||||||
FATAL_ERROR_IF(!m_mapgens.empty(), "Mapgen already initialised.");
|
FATAL_ERROR_IF(!m_mapgens.empty(), "Mapgen already initialised.");
|
||||||
|
|
||||||
mgparams = params;
|
mgparams = params;
|
||||||
|
|
||||||
for (u32 i = 0; i != m_threads.size(); i++)
|
for (u32 i = 0; i != m_threads.size(); i++) {
|
||||||
m_mapgens.push_back(Mapgen::createMapgen(params->mgtype, params, this));
|
EmergeParams *p = new EmergeParams(
|
||||||
|
this, biomemgr, oremgr, decomgr, schemmgr);
|
||||||
|
infostream << "EmergeManager: Created params " << p
|
||||||
|
<< " for thread " << i << std::endl;
|
||||||
|
m_mapgens.push_back(Mapgen::createMapgen(params->mgtype, params, p));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
48
src/emerge.h
48
src/emerge.h
@ -86,6 +86,30 @@ struct BlockEmergeData {
|
|||||||
EmergeCallbackList callbacks;
|
EmergeCallbackList callbacks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class EmergeParams {
|
||||||
|
friend class EmergeManager;
|
||||||
|
public:
|
||||||
|
EmergeParams() = delete;
|
||||||
|
~EmergeParams();
|
||||||
|
DISABLE_CLASS_COPY(EmergeParams);
|
||||||
|
|
||||||
|
const NodeDefManager *ndef; // shared
|
||||||
|
bool enable_mapgen_debug_info;
|
||||||
|
|
||||||
|
u32 gen_notify_on;
|
||||||
|
const std::set<u32> *gen_notify_on_deco_ids; // shared
|
||||||
|
|
||||||
|
BiomeManager *biomemgr;
|
||||||
|
OreManager *oremgr;
|
||||||
|
DecorationManager *decomgr;
|
||||||
|
SchematicManager *schemmgr;
|
||||||
|
|
||||||
|
private:
|
||||||
|
EmergeParams(EmergeManager *parent, const BiomeManager *biomemgr,
|
||||||
|
const OreManager *oremgr, const DecorationManager *decomgr,
|
||||||
|
const SchematicManager *schemmgr);
|
||||||
|
};
|
||||||
|
|
||||||
class EmergeManager {
|
class EmergeManager {
|
||||||
public:
|
public:
|
||||||
const NodeDefManager *ndef;
|
const NodeDefManager *ndef;
|
||||||
@ -106,17 +130,22 @@ public:
|
|||||||
// Environment is not created until after script initialization.
|
// Environment is not created until after script initialization.
|
||||||
MapSettingsManager *map_settings_mgr;
|
MapSettingsManager *map_settings_mgr;
|
||||||
|
|
||||||
// Managers of various map generation-related components
|
|
||||||
BiomeManager *biomemgr;
|
|
||||||
OreManager *oremgr;
|
|
||||||
DecorationManager *decomgr;
|
|
||||||
SchematicManager *schemmgr;
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
EmergeManager(Server *server);
|
EmergeManager(Server *server);
|
||||||
~EmergeManager();
|
~EmergeManager();
|
||||||
DISABLE_CLASS_COPY(EmergeManager);
|
DISABLE_CLASS_COPY(EmergeManager);
|
||||||
|
|
||||||
|
// no usage restrictions
|
||||||
|
const BiomeManager *getBiomeManager() const { return biomemgr; }
|
||||||
|
const OreManager *getOreManager() const { return oremgr; }
|
||||||
|
const DecorationManager *getDecorationManager() const { return decomgr; }
|
||||||
|
const SchematicManager *getSchematicManager() const { return schemmgr; }
|
||||||
|
// only usable before mapgen init
|
||||||
|
BiomeManager *getWritableBiomeManager();
|
||||||
|
OreManager *getWritableOreManager();
|
||||||
|
DecorationManager *getWritableDecorationManager();
|
||||||
|
SchematicManager *getWritableSchematicManager();
|
||||||
|
|
||||||
void initMapgens(MapgenParams *mgparams);
|
void initMapgens(MapgenParams *mgparams);
|
||||||
|
|
||||||
void startThreads();
|
void startThreads();
|
||||||
@ -160,6 +189,13 @@ private:
|
|||||||
u16 m_qlimit_diskonly;
|
u16 m_qlimit_diskonly;
|
||||||
u16 m_qlimit_generate;
|
u16 m_qlimit_generate;
|
||||||
|
|
||||||
|
// Managers of various map generation-related components
|
||||||
|
// Note that each Mapgen gets a copy(!) of these to work with
|
||||||
|
BiomeManager *biomemgr;
|
||||||
|
OreManager *oremgr;
|
||||||
|
DecorationManager *decomgr;
|
||||||
|
SchematicManager *schemmgr;
|
||||||
|
|
||||||
// Requires m_queue_mutex held
|
// Requires m_queue_mutex held
|
||||||
EmergeThread *getOptimalThread();
|
EmergeThread *getOptimalThread();
|
||||||
|
|
||||||
|
@ -106,8 +106,8 @@ STATIC_ASSERT(
|
|||||||
//// Mapgen
|
//// Mapgen
|
||||||
////
|
////
|
||||||
|
|
||||||
Mapgen::Mapgen(int mapgenid, MapgenParams *params, EmergeManager *emerge) :
|
Mapgen::Mapgen(int mapgenid, MapgenParams *params, EmergeParams *emerge) :
|
||||||
gennotify(emerge->gen_notify_on, &emerge->gen_notify_on_deco_ids)
|
gennotify(emerge->gen_notify_on, emerge->gen_notify_on_deco_ids)
|
||||||
{
|
{
|
||||||
id = mapgenid;
|
id = mapgenid;
|
||||||
water_level = params->water_level;
|
water_level = params->water_level;
|
||||||
@ -156,7 +156,7 @@ const char *Mapgen::getMapgenName(MapgenType mgtype)
|
|||||||
|
|
||||||
|
|
||||||
Mapgen *Mapgen::createMapgen(MapgenType mgtype, MapgenParams *params,
|
Mapgen *Mapgen::createMapgen(MapgenType mgtype, MapgenParams *params,
|
||||||
EmergeManager *emerge)
|
EmergeParams *emerge)
|
||||||
{
|
{
|
||||||
switch (mgtype) {
|
switch (mgtype) {
|
||||||
case MAPGEN_CARPATHIAN:
|
case MAPGEN_CARPATHIAN:
|
||||||
@ -585,7 +585,7 @@ void Mapgen::spreadLight(const v3s16 &nmin, const v3s16 &nmax)
|
|||||||
//// MapgenBasic
|
//// MapgenBasic
|
||||||
////
|
////
|
||||||
|
|
||||||
MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emerge)
|
MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeParams *emerge)
|
||||||
: Mapgen(mapgenid, params, emerge)
|
: Mapgen(mapgenid, params, emerge)
|
||||||
{
|
{
|
||||||
this->m_emerge = emerge;
|
this->m_emerge = emerge;
|
||||||
@ -642,6 +642,8 @@ MapgenBasic::~MapgenBasic()
|
|||||||
{
|
{
|
||||||
delete biomegen;
|
delete biomegen;
|
||||||
delete []heightmap;
|
delete []heightmap;
|
||||||
|
|
||||||
|
delete m_emerge; // destroying EmergeParams is our responsibility
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -974,7 +976,7 @@ void MapgenBasic::generateDungeons(s16 max_stone_y)
|
|||||||
////
|
////
|
||||||
|
|
||||||
GenerateNotifier::GenerateNotifier(u32 notify_on,
|
GenerateNotifier::GenerateNotifier(u32 notify_on,
|
||||||
std::set<u32> *notify_on_deco_ids)
|
const std::set<u32> *notify_on_deco_ids)
|
||||||
{
|
{
|
||||||
m_notify_on = notify_on;
|
m_notify_on = notify_on;
|
||||||
m_notify_on_deco_ids = notify_on_deco_ids;
|
m_notify_on_deco_ids = notify_on_deco_ids;
|
||||||
@ -987,7 +989,8 @@ void GenerateNotifier::setNotifyOn(u32 notify_on)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GenerateNotifier::setNotifyOnDecoIds(std::set<u32> *notify_on_deco_ids)
|
void GenerateNotifier::setNotifyOnDecoIds(
|
||||||
|
const std::set<u32> *notify_on_deco_ids)
|
||||||
{
|
{
|
||||||
m_notify_on_deco_ids = notify_on_deco_ids;
|
m_notify_on_deco_ids = notify_on_deco_ids;
|
||||||
}
|
}
|
||||||
@ -999,7 +1002,7 @@ bool GenerateNotifier::addEvent(GenNotifyType type, v3s16 pos, u32 id)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (type == GENNOTIFY_DECORATION &&
|
if (type == GENNOTIFY_DECORATION &&
|
||||||
m_notify_on_deco_ids->find(id) == m_notify_on_deco_ids->end())
|
m_notify_on_deco_ids->find(id) == m_notify_on_deco_ids->cend())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
GenNotifyEvent gne;
|
GenNotifyEvent gne;
|
||||||
|
@ -51,6 +51,7 @@ class Biome;
|
|||||||
class BiomeGen;
|
class BiomeGen;
|
||||||
struct BiomeParams;
|
struct BiomeParams;
|
||||||
class BiomeManager;
|
class BiomeManager;
|
||||||
|
class EmergeParams;
|
||||||
class EmergeManager;
|
class EmergeManager;
|
||||||
class MapBlock;
|
class MapBlock;
|
||||||
class VoxelManipulator;
|
class VoxelManipulator;
|
||||||
@ -87,10 +88,10 @@ struct GenNotifyEvent {
|
|||||||
class GenerateNotifier {
|
class GenerateNotifier {
|
||||||
public:
|
public:
|
||||||
GenerateNotifier() = default;
|
GenerateNotifier() = default;
|
||||||
GenerateNotifier(u32 notify_on, std::set<u32> *notify_on_deco_ids);
|
GenerateNotifier(u32 notify_on, const std::set<u32> *notify_on_deco_ids);
|
||||||
|
|
||||||
void setNotifyOn(u32 notify_on);
|
void setNotifyOn(u32 notify_on);
|
||||||
void setNotifyOnDecoIds(std::set<u32> *notify_on_deco_ids);
|
void setNotifyOnDecoIds(const std::set<u32> *notify_on_deco_ids);
|
||||||
|
|
||||||
bool addEvent(GenNotifyType type, v3s16 pos, u32 id=0);
|
bool addEvent(GenNotifyType type, v3s16 pos, u32 id=0);
|
||||||
void getEvents(std::map<std::string, std::vector<v3s16> > &event_map);
|
void getEvents(std::map<std::string, std::vector<v3s16> > &event_map);
|
||||||
@ -98,7 +99,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
u32 m_notify_on = 0;
|
u32 m_notify_on = 0;
|
||||||
std::set<u32> *m_notify_on_deco_ids;
|
const std::set<u32> *m_notify_on_deco_ids;
|
||||||
std::list<GenNotifyEvent> m_notify_events;
|
std::list<GenNotifyEvent> m_notify_events;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -176,7 +177,7 @@ public:
|
|||||||
GenerateNotifier gennotify;
|
GenerateNotifier gennotify;
|
||||||
|
|
||||||
Mapgen() = default;
|
Mapgen() = default;
|
||||||
Mapgen(int mapgenid, MapgenParams *params, EmergeManager *emerge);
|
Mapgen(int mapgenid, MapgenParams *params, EmergeParams *emerge);
|
||||||
virtual ~Mapgen() = default;
|
virtual ~Mapgen() = default;
|
||||||
DISABLE_CLASS_COPY(Mapgen);
|
DISABLE_CLASS_COPY(Mapgen);
|
||||||
|
|
||||||
@ -215,7 +216,7 @@ public:
|
|||||||
static MapgenType getMapgenType(const std::string &mgname);
|
static MapgenType getMapgenType(const std::string &mgname);
|
||||||
static const char *getMapgenName(MapgenType mgtype);
|
static const char *getMapgenName(MapgenType mgtype);
|
||||||
static Mapgen *createMapgen(MapgenType mgtype, MapgenParams *params,
|
static Mapgen *createMapgen(MapgenType mgtype, MapgenParams *params,
|
||||||
EmergeManager *emerge);
|
EmergeParams *emerge);
|
||||||
static MapgenParams *createMapgenParams(MapgenType mgtype);
|
static MapgenParams *createMapgenParams(MapgenType mgtype);
|
||||||
static void getMapgenNames(std::vector<const char *> *mgnames, bool include_hidden);
|
static void getMapgenNames(std::vector<const char *> *mgnames, bool include_hidden);
|
||||||
static void setDefaultSettings(Settings *settings);
|
static void setDefaultSettings(Settings *settings);
|
||||||
@ -243,7 +244,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
class MapgenBasic : public Mapgen {
|
class MapgenBasic : public Mapgen {
|
||||||
public:
|
public:
|
||||||
MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emerge);
|
MapgenBasic(int mapgenid, MapgenParams *params, EmergeParams *emerge);
|
||||||
virtual ~MapgenBasic();
|
virtual ~MapgenBasic();
|
||||||
|
|
||||||
virtual void generateBiomes();
|
virtual void generateBiomes();
|
||||||
@ -254,7 +255,7 @@ public:
|
|||||||
virtual void generateDungeons(s16 max_stone_y);
|
virtual void generateDungeons(s16 max_stone_y);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
EmergeManager *m_emerge;
|
EmergeParams *m_emerge;
|
||||||
BiomeManager *m_bmgr;
|
BiomeManager *m_bmgr;
|
||||||
|
|
||||||
Noise *noise_filler_depth;
|
Noise *noise_filler_depth;
|
||||||
|
@ -49,7 +49,7 @@ FlagDesc flagdesc_mapgen_carpathian[] = {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
MapgenCarpathian::MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager *emerge)
|
MapgenCarpathian::MapgenCarpathian(MapgenCarpathianParams *params, EmergeParams *emerge)
|
||||||
: MapgenBasic(MAPGEN_CARPATHIAN, params, emerge)
|
: MapgenBasic(MAPGEN_CARPATHIAN, params, emerge)
|
||||||
{
|
{
|
||||||
base_level = params->base_level;
|
base_level = params->base_level;
|
||||||
|
@ -79,7 +79,7 @@ struct MapgenCarpathianParams : public MapgenParams
|
|||||||
class MapgenCarpathian : public MapgenBasic
|
class MapgenCarpathian : public MapgenBasic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager *emerge);
|
MapgenCarpathian(MapgenCarpathianParams *params, EmergeParams *emerge);
|
||||||
~MapgenCarpathian();
|
~MapgenCarpathian();
|
||||||
|
|
||||||
virtual MapgenType getType() const { return MAPGEN_CARPATHIAN; }
|
virtual MapgenType getType() const { return MAPGEN_CARPATHIAN; }
|
||||||
|
@ -47,7 +47,7 @@ FlagDesc flagdesc_mapgen_flat[] = {
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
MapgenFlat::MapgenFlat(MapgenFlatParams *params, EmergeManager *emerge)
|
MapgenFlat::MapgenFlat(MapgenFlatParams *params, EmergeParams *emerge)
|
||||||
: MapgenBasic(MAPGEN_FLAT, params, emerge)
|
: MapgenBasic(MAPGEN_FLAT, params, emerge)
|
||||||
{
|
{
|
||||||
spflags = params->spflags;
|
spflags = params->spflags;
|
||||||
|
@ -64,7 +64,7 @@ struct MapgenFlatParams : public MapgenParams
|
|||||||
class MapgenFlat : public MapgenBasic
|
class MapgenFlat : public MapgenBasic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MapgenFlat(MapgenFlatParams *params, EmergeManager *emerge);
|
MapgenFlat(MapgenFlatParams *params, EmergeParams *emerge);
|
||||||
~MapgenFlat();
|
~MapgenFlat();
|
||||||
|
|
||||||
virtual MapgenType getType() const { return MAPGEN_FLAT; }
|
virtual MapgenType getType() const { return MAPGEN_FLAT; }
|
||||||
|
@ -47,7 +47,7 @@ FlagDesc flagdesc_mapgen_fractal[] = {
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
MapgenFractal::MapgenFractal(MapgenFractalParams *params, EmergeManager *emerge)
|
MapgenFractal::MapgenFractal(MapgenFractalParams *params, EmergeParams *emerge)
|
||||||
: MapgenBasic(MAPGEN_FRACTAL, params, emerge)
|
: MapgenBasic(MAPGEN_FRACTAL, params, emerge)
|
||||||
{
|
{
|
||||||
spflags = params->spflags;
|
spflags = params->spflags;
|
||||||
|
@ -72,7 +72,7 @@ struct MapgenFractalParams : public MapgenParams
|
|||||||
class MapgenFractal : public MapgenBasic
|
class MapgenFractal : public MapgenBasic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MapgenFractal(MapgenFractalParams *params, EmergeManager *emerge);
|
MapgenFractal(MapgenFractalParams *params, EmergeParams *emerge);
|
||||||
~MapgenFractal();
|
~MapgenFractal();
|
||||||
|
|
||||||
virtual MapgenType getType() const { return MAPGEN_FRACTAL; }
|
virtual MapgenType getType() const { return MAPGEN_FRACTAL; }
|
||||||
|
@ -29,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "emerge.h"
|
#include "emerge.h"
|
||||||
|
|
||||||
|
|
||||||
MapgenSinglenode::MapgenSinglenode(MapgenParams *params, EmergeManager *emerge)
|
MapgenSinglenode::MapgenSinglenode(MapgenParams *params, EmergeParams *emerge)
|
||||||
: Mapgen(MAPGEN_SINGLENODE, params, emerge)
|
: Mapgen(MAPGEN_SINGLENODE, 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(MapgenParams *params, EmergeManager *emerge);
|
MapgenSinglenode(MapgenParams *params, EmergeParams *emerge);
|
||||||
~MapgenSinglenode() = default;
|
~MapgenSinglenode() = default;
|
||||||
|
|
||||||
virtual MapgenType getType() const { return MAPGEN_SINGLENODE; }
|
virtual MapgenType getType() const { return MAPGEN_SINGLENODE; }
|
||||||
|
@ -44,7 +44,7 @@ FlagDesc flagdesc_mapgen_v5[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
MapgenV5::MapgenV5(MapgenV5Params *params, EmergeManager *emerge)
|
MapgenV5::MapgenV5(MapgenV5Params *params, EmergeParams *emerge)
|
||||||
: MapgenBasic(MAPGEN_V5, params, emerge)
|
: MapgenBasic(MAPGEN_V5, params, emerge)
|
||||||
{
|
{
|
||||||
spflags = params->spflags;
|
spflags = params->spflags;
|
||||||
|
@ -64,7 +64,7 @@ struct MapgenV5Params : public MapgenParams
|
|||||||
class MapgenV5 : public MapgenBasic
|
class MapgenV5 : public MapgenBasic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MapgenV5(MapgenV5Params *params, EmergeManager *emerge);
|
MapgenV5(MapgenV5Params *params, EmergeParams *emerge);
|
||||||
~MapgenV5();
|
~MapgenV5();
|
||||||
|
|
||||||
virtual MapgenType getType() const { return MAPGEN_V5; }
|
virtual MapgenType getType() const { return MAPGEN_V5; }
|
||||||
|
@ -54,7 +54,7 @@ FlagDesc flagdesc_mapgen_v6[] = {
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
MapgenV6::MapgenV6(MapgenV6Params *params, EmergeManager *emerge)
|
MapgenV6::MapgenV6(MapgenV6Params *params, EmergeParams *emerge)
|
||||||
: Mapgen(MAPGEN_V6, params, emerge)
|
: Mapgen(MAPGEN_V6, params, emerge)
|
||||||
{
|
{
|
||||||
m_emerge = emerge;
|
m_emerge = emerge;
|
||||||
@ -160,6 +160,8 @@ MapgenV6::~MapgenV6()
|
|||||||
delete noise_humidity;
|
delete noise_humidity;
|
||||||
|
|
||||||
delete[] heightmap;
|
delete[] heightmap;
|
||||||
|
|
||||||
|
delete m_emerge; // our responsibility
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ struct MapgenV6Params : public MapgenParams {
|
|||||||
|
|
||||||
class MapgenV6 : public Mapgen {
|
class MapgenV6 : public Mapgen {
|
||||||
public:
|
public:
|
||||||
EmergeManager *m_emerge;
|
EmergeParams *m_emerge;
|
||||||
|
|
||||||
int ystride;
|
int ystride;
|
||||||
u32 spflags;
|
u32 spflags;
|
||||||
@ -133,7 +133,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(MapgenV6Params *params, EmergeManager *emerge);
|
MapgenV6(MapgenV6Params *params, EmergeParams *emerge);
|
||||||
~MapgenV6();
|
~MapgenV6();
|
||||||
|
|
||||||
virtual MapgenType getType() const { return MAPGEN_V6; }
|
virtual MapgenType getType() const { return MAPGEN_V6; }
|
||||||
|
@ -51,7 +51,7 @@ FlagDesc flagdesc_mapgen_v7[] = {
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
MapgenV7::MapgenV7(MapgenV7Params *params, EmergeManager *emerge)
|
MapgenV7::MapgenV7(MapgenV7Params *params, EmergeParams *emerge)
|
||||||
: MapgenBasic(MAPGEN_V7, params, emerge)
|
: MapgenBasic(MAPGEN_V7, params, emerge)
|
||||||
{
|
{
|
||||||
spflags = params->spflags;
|
spflags = params->spflags;
|
||||||
|
@ -75,7 +75,7 @@ struct MapgenV7Params : public MapgenParams {
|
|||||||
|
|
||||||
class MapgenV7 : public MapgenBasic {
|
class MapgenV7 : public MapgenBasic {
|
||||||
public:
|
public:
|
||||||
MapgenV7(MapgenV7Params *params, EmergeManager *emerge);
|
MapgenV7(MapgenV7Params *params, EmergeParams *emerge);
|
||||||
~MapgenV7();
|
~MapgenV7();
|
||||||
|
|
||||||
virtual MapgenType getType() const { return MAPGEN_V7; }
|
virtual MapgenType getType() const { return MAPGEN_V7; }
|
||||||
|
@ -54,7 +54,7 @@ FlagDesc flagdesc_mapgen_valleys[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
MapgenValleys::MapgenValleys(MapgenValleysParams *params, EmergeManager *emerge)
|
MapgenValleys::MapgenValleys(MapgenValleysParams *params, EmergeParams *emerge)
|
||||||
: MapgenBasic(MAPGEN_VALLEYS, params, emerge)
|
: MapgenBasic(MAPGEN_VALLEYS, params, emerge)
|
||||||
{
|
{
|
||||||
// NOTE: MapgenValleys has a hard dependency on BiomeGenOriginal
|
// NOTE: MapgenValleys has a hard dependency on BiomeGenOriginal
|
||||||
|
@ -84,7 +84,7 @@ class MapgenValleys : public MapgenBasic {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
MapgenValleys(MapgenValleysParams *params,
|
MapgenValleys(MapgenValleysParams *params,
|
||||||
EmergeManager *emerge);
|
EmergeParams *emerge);
|
||||||
~MapgenValleys();
|
~MapgenValleys();
|
||||||
|
|
||||||
virtual MapgenType getType() const { return MAPGEN_VALLEYS; }
|
virtual MapgenType getType() const { return MAPGEN_VALLEYS; }
|
||||||
|
@ -78,7 +78,7 @@ void BiomeManager::clear()
|
|||||||
EmergeManager *emerge = m_server->getEmergeManager();
|
EmergeManager *emerge = m_server->getEmergeManager();
|
||||||
|
|
||||||
// Remove all dangling references in Decorations
|
// Remove all dangling references in Decorations
|
||||||
DecorationManager *decomgr = emerge->decomgr;
|
DecorationManager *decomgr = emerge->getWritableDecorationManager();
|
||||||
for (size_t i = 0; i != decomgr->getNumObjects(); i++) {
|
for (size_t i = 0; i != decomgr->getNumObjects(); i++) {
|
||||||
Decoration *deco = (Decoration *)decomgr->getRaw(i);
|
Decoration *deco = (Decoration *)decomgr->getRaw(i);
|
||||||
deco->biomes.clear();
|
deco->biomes.clear();
|
||||||
@ -104,7 +104,7 @@ BiomeManager *BiomeManager::clone() const
|
|||||||
|
|
||||||
// For BiomeGen type 'BiomeGenOriginal'
|
// For BiomeGen type 'BiomeGenOriginal'
|
||||||
float BiomeManager::getHeatAtPosOriginal(v3s16 pos, NoiseParams &np_heat,
|
float BiomeManager::getHeatAtPosOriginal(v3s16 pos, NoiseParams &np_heat,
|
||||||
NoiseParams &np_heat_blend, u64 seed)
|
NoiseParams &np_heat_blend, u64 seed) const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
NoisePerlin2D(&np_heat, pos.X, pos.Z, seed) +
|
NoisePerlin2D(&np_heat, pos.X, pos.Z, seed) +
|
||||||
@ -114,7 +114,7 @@ float BiomeManager::getHeatAtPosOriginal(v3s16 pos, NoiseParams &np_heat,
|
|||||||
|
|
||||||
// For BiomeGen type 'BiomeGenOriginal'
|
// For BiomeGen type 'BiomeGenOriginal'
|
||||||
float BiomeManager::getHumidityAtPosOriginal(v3s16 pos, NoiseParams &np_humidity,
|
float BiomeManager::getHumidityAtPosOriginal(v3s16 pos, NoiseParams &np_humidity,
|
||||||
NoiseParams &np_humidity_blend, u64 seed)
|
NoiseParams &np_humidity_blend, u64 seed) const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
NoisePerlin2D(&np_humidity, pos.X, pos.Z, seed) +
|
NoisePerlin2D(&np_humidity, pos.X, pos.Z, seed) +
|
||||||
@ -123,7 +123,7 @@ float BiomeManager::getHumidityAtPosOriginal(v3s16 pos, NoiseParams &np_humidity
|
|||||||
|
|
||||||
|
|
||||||
// For BiomeGen type 'BiomeGenOriginal'
|
// For BiomeGen type 'BiomeGenOriginal'
|
||||||
Biome *BiomeManager::getBiomeFromNoiseOriginal(float heat, float humidity, v3s16 pos)
|
Biome *BiomeManager::getBiomeFromNoiseOriginal(float heat, float humidity, v3s16 pos) const
|
||||||
{
|
{
|
||||||
Biome *biome_closest = nullptr;
|
Biome *biome_closest = nullptr;
|
||||||
Biome *biome_closest_blend = nullptr;
|
Biome *biome_closest_blend = nullptr;
|
||||||
|
@ -230,10 +230,10 @@ public:
|
|||||||
|
|
||||||
// For BiomeGen type 'BiomeGenOriginal'
|
// For BiomeGen type 'BiomeGenOriginal'
|
||||||
float getHeatAtPosOriginal(v3s16 pos, NoiseParams &np_heat,
|
float getHeatAtPosOriginal(v3s16 pos, NoiseParams &np_heat,
|
||||||
NoiseParams &np_heat_blend, u64 seed);
|
NoiseParams &np_heat_blend, u64 seed) const;
|
||||||
float getHumidityAtPosOriginal(v3s16 pos, NoiseParams &np_humidity,
|
float getHumidityAtPosOriginal(v3s16 pos, NoiseParams &np_humidity,
|
||||||
NoiseParams &np_humidity_blend, u64 seed);
|
NoiseParams &np_humidity_blend, u64 seed) const;
|
||||||
Biome *getBiomeFromNoiseOriginal(float heat, float humidity, v3s16 pos);
|
Biome *getBiomeFromNoiseOriginal(float heat, float humidity, v3s16 pos) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BiomeManager() {};
|
BiomeManager() {};
|
||||||
|
@ -391,6 +391,13 @@ size_t DecoSimple::generate(MMVManip *vm, PcgRandom *pr, v3s16 p, bool ceiling)
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
DecoSchematic::~DecoSchematic()
|
||||||
|
{
|
||||||
|
if (was_cloned)
|
||||||
|
delete schematic;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ObjDef *DecoSchematic::clone() const
|
ObjDef *DecoSchematic::clone() const
|
||||||
{
|
{
|
||||||
auto def = new DecoSchematic();
|
auto def = new DecoSchematic();
|
||||||
@ -398,9 +405,12 @@ ObjDef *DecoSchematic::clone() const
|
|||||||
NodeResolver::cloneTo(def);
|
NodeResolver::cloneTo(def);
|
||||||
|
|
||||||
def->rotation = rotation;
|
def->rotation = rotation;
|
||||||
/* FIXME: This is not ideal, we only have a pointer to the schematic despite
|
/* FIXME: We do not own this schematic, yet we only have a pointer to it
|
||||||
* not owning it. Optimally this would be a handle. */
|
* and not a handle. We are left with no option but to clone it ourselves.
|
||||||
def->schematic = schematic; // not cloned
|
* This is a waste of memory and should be replaced with an alternative
|
||||||
|
* approach sometime. */
|
||||||
|
def->schematic = dynamic_cast<Schematic*>(schematic->clone());
|
||||||
|
def->was_cloned = true;
|
||||||
|
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
@ -99,11 +99,13 @@ public:
|
|||||||
ObjDef *clone() const;
|
ObjDef *clone() const;
|
||||||
|
|
||||||
DecoSchematic() = default;
|
DecoSchematic() = default;
|
||||||
|
virtual ~DecoSchematic();
|
||||||
|
|
||||||
virtual size_t generate(MMVManip *vm, PcgRandom *pr, v3s16 p, bool ceiling);
|
virtual size_t generate(MMVManip *vm, PcgRandom *pr, v3s16 p, bool ceiling);
|
||||||
|
|
||||||
Rotation rotation;
|
Rotation rotation;
|
||||||
Schematic *schematic = nullptr;
|
Schematic *schematic = nullptr;
|
||||||
|
bool was_cloned = false; // see FIXME inside DecoSchemtic::clone()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,12 +43,21 @@ SchematicManager::SchematicManager(Server *server) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SchematicManager *SchematicManager::clone() const
|
||||||
|
{
|
||||||
|
auto mgr = new SchematicManager();
|
||||||
|
assert(mgr);
|
||||||
|
ObjDefManager::cloneTo(mgr);
|
||||||
|
return mgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SchematicManager::clear()
|
void SchematicManager::clear()
|
||||||
{
|
{
|
||||||
EmergeManager *emerge = m_server->getEmergeManager();
|
EmergeManager *emerge = m_server->getEmergeManager();
|
||||||
|
|
||||||
// Remove all dangling references in Decorations
|
// Remove all dangling references in Decorations
|
||||||
DecorationManager *decomgr = emerge->decomgr;
|
DecorationManager *decomgr = emerge->getWritableDecorationManager();
|
||||||
for (size_t i = 0; i != decomgr->getNumObjects(); i++) {
|
for (size_t i = 0; i != decomgr->getNumObjects(); i++) {
|
||||||
Decoration *deco = (Decoration *)decomgr->getRaw(i);
|
Decoration *deco = (Decoration *)decomgr->getRaw(i);
|
||||||
|
|
||||||
@ -79,7 +88,21 @@ Schematic::~Schematic()
|
|||||||
|
|
||||||
ObjDef *Schematic::clone() const
|
ObjDef *Schematic::clone() const
|
||||||
{
|
{
|
||||||
FATAL_ERROR("not cloneable");
|
auto def = new Schematic();
|
||||||
|
ObjDef::cloneTo(def);
|
||||||
|
NodeResolver::cloneTo(def);
|
||||||
|
|
||||||
|
def->c_nodes = c_nodes;
|
||||||
|
def->flags = flags;
|
||||||
|
def->size = size;
|
||||||
|
FATAL_ERROR_IF(!schemdata, "Schematic can only be cloned after loading");
|
||||||
|
u32 nodecount = size.X * size.Y * size.Z;
|
||||||
|
def->schemdata = new MapNode[nodecount];
|
||||||
|
memcpy(def->schemdata, schemdata, sizeof(MapNode) * nodecount);
|
||||||
|
def->slice_probs = new u8[size.Y];
|
||||||
|
memcpy(def->slice_probs, slice_probs, sizeof(u8) * size.Y);
|
||||||
|
|
||||||
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ public:
|
|||||||
SchematicManager(Server *server);
|
SchematicManager(Server *server);
|
||||||
virtual ~SchematicManager() = default;
|
virtual ~SchematicManager() = default;
|
||||||
|
|
||||||
// not cloneable
|
SchematicManager *clone() const;
|
||||||
|
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
||||||
@ -145,6 +145,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
SchematicManager() {};
|
||||||
|
|
||||||
Server *m_server;
|
Server *m_server;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ struct EnumString ModApiMapgen::es_SchematicFormatType[] =
|
|||||||
{0, NULL},
|
{0, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
ObjDef *get_objdef(lua_State *L, int index, ObjDefManager *objmgr);
|
ObjDef *get_objdef(lua_State *L, int index, const ObjDefManager *objmgr);
|
||||||
|
|
||||||
Biome *get_or_load_biome(lua_State *L, int index,
|
Biome *get_or_load_biome(lua_State *L, int index,
|
||||||
BiomeManager *biomemgr);
|
BiomeManager *biomemgr);
|
||||||
@ -114,7 +114,7 @@ bool read_deco_schematic(lua_State *L, SchematicManager *schemmgr, DecoSchematic
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ObjDef *get_objdef(lua_State *L, int index, ObjDefManager *objmgr)
|
ObjDef *get_objdef(lua_State *L, int index, const ObjDefManager *objmgr)
|
||||||
{
|
{
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
index = lua_gettop(L) + 1 + index;
|
index = lua_gettop(L) + 1 + index;
|
||||||
@ -486,7 +486,7 @@ int ModApiMapgen::l_get_biome_id(lua_State *L)
|
|||||||
if (!biome_str)
|
if (!biome_str)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
|
const BiomeManager *bmgr = getServer(L)->getEmergeManager()->getBiomeManager();
|
||||||
if (!bmgr)
|
if (!bmgr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -508,7 +508,7 @@ int ModApiMapgen::l_get_biome_name(lua_State *L)
|
|||||||
|
|
||||||
int biome_id = luaL_checkinteger(L, 1);
|
int biome_id = luaL_checkinteger(L, 1);
|
||||||
|
|
||||||
BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
|
const BiomeManager *bmgr = getServer(L)->getEmergeManager()->getBiomeManager();
|
||||||
if (!bmgr)
|
if (!bmgr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -546,7 +546,7 @@ int ModApiMapgen::l_get_heat(lua_State *L)
|
|||||||
u64 seed;
|
u64 seed;
|
||||||
ss >> seed;
|
ss >> seed;
|
||||||
|
|
||||||
BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
|
const BiomeManager *bmgr = getServer(L)->getEmergeManager()->getBiomeManager();
|
||||||
if (!bmgr)
|
if (!bmgr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -587,7 +587,7 @@ int ModApiMapgen::l_get_humidity(lua_State *L)
|
|||||||
u64 seed;
|
u64 seed;
|
||||||
ss >> seed;
|
ss >> seed;
|
||||||
|
|
||||||
BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
|
const BiomeManager *bmgr = getServer(L)->getEmergeManager()->getBiomeManager();
|
||||||
if (!bmgr)
|
if (!bmgr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -635,7 +635,7 @@ int ModApiMapgen::l_get_biome_data(lua_State *L)
|
|||||||
u64 seed;
|
u64 seed;
|
||||||
ss >> seed;
|
ss >> seed;
|
||||||
|
|
||||||
BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
|
const BiomeManager *bmgr = getServer(L)->getEmergeManager()->getBiomeManager();
|
||||||
if (!bmgr)
|
if (!bmgr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1066,7 +1066,8 @@ int ModApiMapgen::l_get_decoration_id(lua_State *L)
|
|||||||
if (!deco_str)
|
if (!deco_str)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
DecorationManager *dmgr = getServer(L)->getEmergeManager()->decomgr;
|
const DecorationManager *dmgr =
|
||||||
|
getServer(L)->getEmergeManager()->getDecorationManager();
|
||||||
|
|
||||||
if (!dmgr)
|
if (!dmgr)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1091,7 +1092,7 @@ int ModApiMapgen::l_register_biome(lua_State *L)
|
|||||||
luaL_checktype(L, index, LUA_TTABLE);
|
luaL_checktype(L, index, LUA_TTABLE);
|
||||||
|
|
||||||
const NodeDefManager *ndef = getServer(L)->getNodeDefManager();
|
const NodeDefManager *ndef = getServer(L)->getNodeDefManager();
|
||||||
BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
|
BiomeManager *bmgr = getServer(L)->getEmergeManager()->getWritableBiomeManager();
|
||||||
|
|
||||||
Biome *biome = read_biome_def(L, index, ndef);
|
Biome *biome = read_biome_def(L, index, ndef);
|
||||||
if (!biome)
|
if (!biome)
|
||||||
@ -1117,9 +1118,10 @@ int ModApiMapgen::l_register_decoration(lua_State *L)
|
|||||||
luaL_checktype(L, index, LUA_TTABLE);
|
luaL_checktype(L, index, LUA_TTABLE);
|
||||||
|
|
||||||
const NodeDefManager *ndef = getServer(L)->getNodeDefManager();
|
const NodeDefManager *ndef = getServer(L)->getNodeDefManager();
|
||||||
DecorationManager *decomgr = getServer(L)->getEmergeManager()->decomgr;
|
EmergeManager *emerge = getServer(L)->getEmergeManager();
|
||||||
BiomeManager *biomemgr = getServer(L)->getEmergeManager()->biomemgr;
|
DecorationManager *decomgr = emerge->getWritableDecorationManager();
|
||||||
SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr;
|
BiomeManager *biomemgr = emerge->getWritableBiomeManager();
|
||||||
|
SchematicManager *schemmgr = emerge->getWritableSchematicManager();
|
||||||
|
|
||||||
enum DecorationType decotype = (DecorationType)getenumfield(L, index,
|
enum DecorationType decotype = (DecorationType)getenumfield(L, index,
|
||||||
"deco_type", es_DecorationType, -1);
|
"deco_type", es_DecorationType, -1);
|
||||||
@ -1274,8 +1276,9 @@ int ModApiMapgen::l_register_ore(lua_State *L)
|
|||||||
luaL_checktype(L, index, LUA_TTABLE);
|
luaL_checktype(L, index, LUA_TTABLE);
|
||||||
|
|
||||||
const NodeDefManager *ndef = getServer(L)->getNodeDefManager();
|
const NodeDefManager *ndef = getServer(L)->getNodeDefManager();
|
||||||
BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
|
EmergeManager *emerge = getServer(L)->getEmergeManager();
|
||||||
OreManager *oremgr = getServer(L)->getEmergeManager()->oremgr;
|
BiomeManager *bmgr = emerge->getWritableBiomeManager();
|
||||||
|
OreManager *oremgr = emerge->getWritableOreManager();
|
||||||
|
|
||||||
enum OreType oretype = (OreType)getenumfield(L, index,
|
enum OreType oretype = (OreType)getenumfield(L, index,
|
||||||
"ore_type", es_OreType, ORE_SCATTER);
|
"ore_type", es_OreType, ORE_SCATTER);
|
||||||
@ -1422,7 +1425,8 @@ int ModApiMapgen::l_register_schematic(lua_State *L)
|
|||||||
{
|
{
|
||||||
NO_MAP_LOCK_REQUIRED;
|
NO_MAP_LOCK_REQUIRED;
|
||||||
|
|
||||||
SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr;
|
SchematicManager *schemmgr =
|
||||||
|
getServer(L)->getEmergeManager()->getWritableSchematicManager();
|
||||||
|
|
||||||
StringMap replace_names;
|
StringMap replace_names;
|
||||||
if (lua_istable(L, 2))
|
if (lua_istable(L, 2))
|
||||||
@ -1449,7 +1453,8 @@ int ModApiMapgen::l_clear_registered_biomes(lua_State *L)
|
|||||||
{
|
{
|
||||||
NO_MAP_LOCK_REQUIRED;
|
NO_MAP_LOCK_REQUIRED;
|
||||||
|
|
||||||
BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
|
BiomeManager *bmgr =
|
||||||
|
getServer(L)->getEmergeManager()->getWritableBiomeManager();
|
||||||
bmgr->clear();
|
bmgr->clear();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1460,7 +1465,8 @@ int ModApiMapgen::l_clear_registered_decorations(lua_State *L)
|
|||||||
{
|
{
|
||||||
NO_MAP_LOCK_REQUIRED;
|
NO_MAP_LOCK_REQUIRED;
|
||||||
|
|
||||||
DecorationManager *dmgr = getServer(L)->getEmergeManager()->decomgr;
|
DecorationManager *dmgr =
|
||||||
|
getServer(L)->getEmergeManager()->getWritableDecorationManager();
|
||||||
dmgr->clear();
|
dmgr->clear();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1471,7 +1477,8 @@ int ModApiMapgen::l_clear_registered_ores(lua_State *L)
|
|||||||
{
|
{
|
||||||
NO_MAP_LOCK_REQUIRED;
|
NO_MAP_LOCK_REQUIRED;
|
||||||
|
|
||||||
OreManager *omgr = getServer(L)->getEmergeManager()->oremgr;
|
OreManager *omgr =
|
||||||
|
getServer(L)->getEmergeManager()->getWritableOreManager();
|
||||||
omgr->clear();
|
omgr->clear();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1482,7 +1489,8 @@ int ModApiMapgen::l_clear_registered_schematics(lua_State *L)
|
|||||||
{
|
{
|
||||||
NO_MAP_LOCK_REQUIRED;
|
NO_MAP_LOCK_REQUIRED;
|
||||||
|
|
||||||
SchematicManager *smgr = getServer(L)->getEmergeManager()->schemmgr;
|
SchematicManager *smgr =
|
||||||
|
getServer(L)->getEmergeManager()->getWritableSchematicManager();
|
||||||
smgr->clear();
|
smgr->clear();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1508,7 +1516,8 @@ int ModApiMapgen::l_generate_ores(lua_State *L)
|
|||||||
|
|
||||||
u32 blockseed = Mapgen::getBlockSeed(pmin, mg.seed);
|
u32 blockseed = Mapgen::getBlockSeed(pmin, mg.seed);
|
||||||
|
|
||||||
emerge->oremgr->placeAllOres(&mg, blockseed, pmin, pmax);
|
OreManager *oremgr = (OreManager*) emerge->getOreManager(); // FIXME FIXME
|
||||||
|
oremgr->placeAllOres(&mg, blockseed, pmin, pmax);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1534,7 +1543,8 @@ int ModApiMapgen::l_generate_decorations(lua_State *L)
|
|||||||
|
|
||||||
u32 blockseed = Mapgen::getBlockSeed(pmin, mg.seed);
|
u32 blockseed = Mapgen::getBlockSeed(pmin, mg.seed);
|
||||||
|
|
||||||
emerge->decomgr->placeAllDecos(&mg, blockseed, pmin, pmax);
|
DecorationManager *decomgr = (DecorationManager*) emerge->getDecorationManager(); // FIXME FIXME
|
||||||
|
decomgr->placeAllDecos(&mg, blockseed, pmin, pmax);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1614,7 +1624,8 @@ int ModApiMapgen::l_place_schematic(lua_State *L)
|
|||||||
GET_ENV_PTR;
|
GET_ENV_PTR;
|
||||||
|
|
||||||
ServerMap *map = &(env->getServerMap());
|
ServerMap *map = &(env->getServerMap());
|
||||||
SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr;
|
SchematicManager *schemmgr = (SchematicManager*)
|
||||||
|
getServer(L)->getEmergeManager()->getSchematicManager(); // FIXME FIXME
|
||||||
|
|
||||||
//// Read position
|
//// Read position
|
||||||
v3s16 p = check_v3s16(L, 1);
|
v3s16 p = check_v3s16(L, 1);
|
||||||
@ -1659,7 +1670,8 @@ int ModApiMapgen::l_place_schematic_on_vmanip(lua_State *L)
|
|||||||
{
|
{
|
||||||
NO_MAP_LOCK_REQUIRED;
|
NO_MAP_LOCK_REQUIRED;
|
||||||
|
|
||||||
SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr;
|
SchematicManager *schemmgr = (SchematicManager*)
|
||||||
|
getServer(L)->getEmergeManager()->getSchematicManager(); // FIXME FIXME
|
||||||
|
|
||||||
//// Read VoxelManip object
|
//// Read VoxelManip object
|
||||||
MMVManip *vm = LuaVoxelManip::checkobject(L, 1)->vm;
|
MMVManip *vm = LuaVoxelManip::checkobject(L, 1)->vm;
|
||||||
@ -1707,7 +1719,7 @@ int ModApiMapgen::l_serialize_schematic(lua_State *L)
|
|||||||
{
|
{
|
||||||
NO_MAP_LOCK_REQUIRED;
|
NO_MAP_LOCK_REQUIRED;
|
||||||
|
|
||||||
SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr;
|
const SchematicManager *schemmgr = getServer(L)->getEmergeManager()->getSchematicManager();
|
||||||
|
|
||||||
//// Read options
|
//// Read options
|
||||||
bool use_comments = getboolfield_default(L, 3, "lua_use_comments", false);
|
bool use_comments = getboolfield_default(L, 3, "lua_use_comments", false);
|
||||||
@ -1758,7 +1770,8 @@ int ModApiMapgen::l_read_schematic(lua_State *L)
|
|||||||
{
|
{
|
||||||
NO_MAP_LOCK_REQUIRED;
|
NO_MAP_LOCK_REQUIRED;
|
||||||
|
|
||||||
SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr;
|
const SchematicManager *schemmgr =
|
||||||
|
getServer(L)->getEmergeManager()->getSchematicManager();
|
||||||
|
|
||||||
//// Read options
|
//// Read options
|
||||||
std::string write_yslice = getstringfield_default(L, 2, "write_yslice_prob", "all");
|
std::string write_yslice = getstringfield_default(L, 2, "write_yslice_prob", "all");
|
||||||
|
Loading…
Reference in New Issue
Block a user