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
////
}
+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)
{
FATAL_ERROR_IF(!m_mapgens.empty(), "Mapgen already initialised.");
mgparams = params;
- for (u32 i = 0; i != m_threads.size(); i++)
- m_mapgens.push_back(Mapgen::createMapgen(params->mgtype, params, this));
+ for (u32 i = 0; i != m_threads.size(); i++) {
+ 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));
+ }
}
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 {
public:
const NodeDefManager *ndef;
// Environment is not created until after script initialization.
MapSettingsManager *map_settings_mgr;
- // Managers of various map generation-related components
- BiomeManager *biomemgr;
- OreManager *oremgr;
- DecorationManager *decomgr;
- SchematicManager *schemmgr;
-
// Methods
EmergeManager(Server *server);
~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 startThreads();
u16 m_qlimit_diskonly;
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
EmergeThread *getOptimalThread();
//// Mapgen
////
-Mapgen::Mapgen(int mapgenid, MapgenParams *params, EmergeManager *emerge) :
- gennotify(emerge->gen_notify_on, &emerge->gen_notify_on_deco_ids)
+Mapgen::Mapgen(int mapgenid, MapgenParams *params, EmergeParams *emerge) :
+ gennotify(emerge->gen_notify_on, emerge->gen_notify_on_deco_ids)
{
id = mapgenid;
water_level = params->water_level;
Mapgen *Mapgen::createMapgen(MapgenType mgtype, MapgenParams *params,
- EmergeManager *emerge)
+ EmergeParams *emerge)
{
switch (mgtype) {
case MAPGEN_CARPATHIAN:
//// MapgenBasic
////
-MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emerge)
+MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeParams *emerge)
: Mapgen(mapgenid, params, emerge)
{
this->m_emerge = emerge;
{
delete biomegen;
delete []heightmap;
+
+ delete m_emerge; // destroying EmergeParams is our responsibility
}
////
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_deco_ids = notify_on_deco_ids;
}
-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;
}
return false;
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;
GenNotifyEvent gne;
class BiomeGen;
struct BiomeParams;
class BiomeManager;
+class EmergeParams;
class EmergeManager;
class MapBlock;
class VoxelManipulator;
class GenerateNotifier {
public:
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 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);
void getEvents(std::map<std::string, std::vector<v3s16> > &event_map);
private:
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;
};
GenerateNotifier gennotify;
Mapgen() = default;
- Mapgen(int mapgenid, MapgenParams *params, EmergeManager *emerge);
+ Mapgen(int mapgenid, MapgenParams *params, EmergeParams *emerge);
virtual ~Mapgen() = default;
DISABLE_CLASS_COPY(Mapgen);
static MapgenType getMapgenType(const std::string &mgname);
static const char *getMapgenName(MapgenType mgtype);
static Mapgen *createMapgen(MapgenType mgtype, MapgenParams *params,
- EmergeManager *emerge);
+ EmergeParams *emerge);
static MapgenParams *createMapgenParams(MapgenType mgtype);
static void getMapgenNames(std::vector<const char *> *mgnames, bool include_hidden);
static void setDefaultSettings(Settings *settings);
*/
class MapgenBasic : public Mapgen {
public:
- MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emerge);
+ MapgenBasic(int mapgenid, MapgenParams *params, EmergeParams *emerge);
virtual ~MapgenBasic();
virtual void generateBiomes();
virtual void generateDungeons(s16 max_stone_y);
protected:
- EmergeManager *m_emerge;
+ EmergeParams *m_emerge;
BiomeManager *m_bmgr;
Noise *noise_filler_depth;
///////////////////////////////////////////////////////////////////////////////
-MapgenCarpathian::MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager *emerge)
+MapgenCarpathian::MapgenCarpathian(MapgenCarpathianParams *params, EmergeParams *emerge)
: MapgenBasic(MAPGEN_CARPATHIAN, params, emerge)
{
base_level = params->base_level;
class MapgenCarpathian : public MapgenBasic
{
public:
- MapgenCarpathian(MapgenCarpathianParams *params, EmergeManager *emerge);
+ MapgenCarpathian(MapgenCarpathianParams *params, EmergeParams *emerge);
~MapgenCarpathian();
virtual MapgenType getType() const { return MAPGEN_CARPATHIAN; }
///////////////////////////////////////////////////////////////////////////////////////
-MapgenFlat::MapgenFlat(MapgenFlatParams *params, EmergeManager *emerge)
+MapgenFlat::MapgenFlat(MapgenFlatParams *params, EmergeParams *emerge)
: MapgenBasic(MAPGEN_FLAT, params, emerge)
{
spflags = params->spflags;
class MapgenFlat : public MapgenBasic
{
public:
- MapgenFlat(MapgenFlatParams *params, EmergeManager *emerge);
+ MapgenFlat(MapgenFlatParams *params, EmergeParams *emerge);
~MapgenFlat();
virtual MapgenType getType() const { return MAPGEN_FLAT; }
///////////////////////////////////////////////////////////////////////////////////////
-MapgenFractal::MapgenFractal(MapgenFractalParams *params, EmergeManager *emerge)
+MapgenFractal::MapgenFractal(MapgenFractalParams *params, EmergeParams *emerge)
: MapgenBasic(MAPGEN_FRACTAL, params, emerge)
{
spflags = params->spflags;
class MapgenFractal : public MapgenBasic
{
public:
- MapgenFractal(MapgenFractalParams *params, EmergeManager *emerge);
+ MapgenFractal(MapgenFractalParams *params, EmergeParams *emerge);
~MapgenFractal();
virtual MapgenType getType() const { return MAPGEN_FRACTAL; }
#include "emerge.h"
-MapgenSinglenode::MapgenSinglenode(MapgenParams *params, EmergeManager *emerge)
+MapgenSinglenode::MapgenSinglenode(MapgenParams *params, EmergeParams *emerge)
: Mapgen(MAPGEN_SINGLENODE, params, emerge)
{
const NodeDefManager *ndef = emerge->ndef;
content_t c_node;
u8 set_light;
- MapgenSinglenode(MapgenParams *params, EmergeManager *emerge);
+ MapgenSinglenode(MapgenParams *params, EmergeParams *emerge);
~MapgenSinglenode() = default;
virtual MapgenType getType() const { return MAPGEN_SINGLENODE; }
};
-MapgenV5::MapgenV5(MapgenV5Params *params, EmergeManager *emerge)
+MapgenV5::MapgenV5(MapgenV5Params *params, EmergeParams *emerge)
: MapgenBasic(MAPGEN_V5, params, emerge)
{
spflags = params->spflags;
class MapgenV5 : public MapgenBasic
{
public:
- MapgenV5(MapgenV5Params *params, EmergeManager *emerge);
+ MapgenV5(MapgenV5Params *params, EmergeParams *emerge);
~MapgenV5();
virtual MapgenType getType() const { return MAPGEN_V5; }
/////////////////////////////////////////////////////////////////////////////
-MapgenV6::MapgenV6(MapgenV6Params *params, EmergeManager *emerge)
+MapgenV6::MapgenV6(MapgenV6Params *params, EmergeParams *emerge)
: Mapgen(MAPGEN_V6, params, emerge)
{
m_emerge = emerge;
delete noise_humidity;
delete[] heightmap;
+
+ delete m_emerge; // our responsibility
}
class MapgenV6 : public Mapgen {
public:
- EmergeManager *m_emerge;
+ EmergeParams *m_emerge;
int ystride;
u32 spflags;
content_t c_stair_cobble;
content_t c_stair_desert_stone;
- MapgenV6(MapgenV6Params *params, EmergeManager *emerge);
+ MapgenV6(MapgenV6Params *params, EmergeParams *emerge);
~MapgenV6();
virtual MapgenType getType() const { return MAPGEN_V6; }
////////////////////////////////////////////////////////////////////////////////
-MapgenV7::MapgenV7(MapgenV7Params *params, EmergeManager *emerge)
+MapgenV7::MapgenV7(MapgenV7Params *params, EmergeParams *emerge)
: MapgenBasic(MAPGEN_V7, params, emerge)
{
spflags = params->spflags;
class MapgenV7 : public MapgenBasic {
public:
- MapgenV7(MapgenV7Params *params, EmergeManager *emerge);
+ MapgenV7(MapgenV7Params *params, EmergeParams *emerge);
~MapgenV7();
virtual MapgenType getType() const { return MAPGEN_V7; }
};
-MapgenValleys::MapgenValleys(MapgenValleysParams *params, EmergeManager *emerge)
+MapgenValleys::MapgenValleys(MapgenValleysParams *params, EmergeParams *emerge)
: MapgenBasic(MAPGEN_VALLEYS, params, emerge)
{
// NOTE: MapgenValleys has a hard dependency on BiomeGenOriginal
public:
MapgenValleys(MapgenValleysParams *params,
- EmergeManager *emerge);
+ EmergeParams *emerge);
~MapgenValleys();
virtual MapgenType getType() const { return MAPGEN_VALLEYS; }
EmergeManager *emerge = m_server->getEmergeManager();
// Remove all dangling references in Decorations
- DecorationManager *decomgr = emerge->decomgr;
+ DecorationManager *decomgr = emerge->getWritableDecorationManager();
for (size_t i = 0; i != decomgr->getNumObjects(); i++) {
Decoration *deco = (Decoration *)decomgr->getRaw(i);
deco->biomes.clear();
// For BiomeGen type 'BiomeGenOriginal'
float BiomeManager::getHeatAtPosOriginal(v3s16 pos, NoiseParams &np_heat,
- NoiseParams &np_heat_blend, u64 seed)
+ NoiseParams &np_heat_blend, u64 seed) const
{
return
NoisePerlin2D(&np_heat, pos.X, pos.Z, seed) +
// For BiomeGen type 'BiomeGenOriginal'
float BiomeManager::getHumidityAtPosOriginal(v3s16 pos, NoiseParams &np_humidity,
- NoiseParams &np_humidity_blend, u64 seed)
+ NoiseParams &np_humidity_blend, u64 seed) const
{
return
NoisePerlin2D(&np_humidity, pos.X, pos.Z, seed) +
// 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_blend = nullptr;
// For BiomeGen type 'BiomeGenOriginal'
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,
- NoiseParams &np_humidity_blend, u64 seed);
- Biome *getBiomeFromNoiseOriginal(float heat, float humidity, v3s16 pos);
+ NoiseParams &np_humidity_blend, u64 seed) const;
+ Biome *getBiomeFromNoiseOriginal(float heat, float humidity, v3s16 pos) const;
private:
BiomeManager() {};
///////////////////////////////////////////////////////////////////////////////
+DecoSchematic::~DecoSchematic()
+{
+ if (was_cloned)
+ delete schematic;
+}
+
+
ObjDef *DecoSchematic::clone() const
{
auto def = new DecoSchematic();
NodeResolver::cloneTo(def);
def->rotation = rotation;
- /* FIXME: This is not ideal, we only have a pointer to the schematic despite
- * not owning it. Optimally this would be a handle. */
- def->schematic = schematic; // not cloned
+ /* FIXME: We do not own this schematic, yet we only have a pointer to it
+ * and not a handle. We are left with no option but to clone it ourselves.
+ * 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;
}
ObjDef *clone() const;
DecoSchematic() = default;
+ virtual ~DecoSchematic();
virtual size_t generate(MMVManip *vm, PcgRandom *pr, v3s16 p, bool ceiling);
Rotation rotation;
Schematic *schematic = nullptr;
+ bool was_cloned = false; // see FIXME inside DecoSchemtic::clone()
};
}
+SchematicManager *SchematicManager::clone() const
+{
+ auto mgr = new SchematicManager();
+ assert(mgr);
+ ObjDefManager::cloneTo(mgr);
+ return mgr;
+}
+
+
void SchematicManager::clear()
{
EmergeManager *emerge = m_server->getEmergeManager();
// Remove all dangling references in Decorations
- DecorationManager *decomgr = emerge->decomgr;
+ DecorationManager *decomgr = emerge->getWritableDecorationManager();
for (size_t i = 0; i != decomgr->getNumObjects(); i++) {
Decoration *deco = (Decoration *)decomgr->getRaw(i);
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;
}
SchematicManager(Server *server);
virtual ~SchematicManager() = default;
- // not cloneable
+ SchematicManager *clone() const;
virtual void clear();
}
private:
+ SchematicManager() {};
+
Server *m_server;
};
{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,
BiomeManager *biomemgr);
///////////////////////////////////////////////////////////////////////////////
-ObjDef *get_objdef(lua_State *L, int index, ObjDefManager *objmgr)
+ObjDef *get_objdef(lua_State *L, int index, const ObjDefManager *objmgr)
{
if (index < 0)
index = lua_gettop(L) + 1 + index;
if (!biome_str)
return 0;
- BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
+ const BiomeManager *bmgr = getServer(L)->getEmergeManager()->getBiomeManager();
if (!bmgr)
return 0;
int biome_id = luaL_checkinteger(L, 1);
- BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
+ const BiomeManager *bmgr = getServer(L)->getEmergeManager()->getBiomeManager();
if (!bmgr)
return 0;
u64 seed;
ss >> seed;
- BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
+ const BiomeManager *bmgr = getServer(L)->getEmergeManager()->getBiomeManager();
if (!bmgr)
return 0;
u64 seed;
ss >> seed;
- BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
+ const BiomeManager *bmgr = getServer(L)->getEmergeManager()->getBiomeManager();
if (!bmgr)
return 0;
u64 seed;
ss >> seed;
- BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
+ const BiomeManager *bmgr = getServer(L)->getEmergeManager()->getBiomeManager();
if (!bmgr)
return 0;
if (!deco_str)
return 0;
- DecorationManager *dmgr = getServer(L)->getEmergeManager()->decomgr;
+ const DecorationManager *dmgr =
+ getServer(L)->getEmergeManager()->getDecorationManager();
if (!dmgr)
return 0;
luaL_checktype(L, index, LUA_TTABLE);
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);
if (!biome)
luaL_checktype(L, index, LUA_TTABLE);
const NodeDefManager *ndef = getServer(L)->getNodeDefManager();
- DecorationManager *decomgr = getServer(L)->getEmergeManager()->decomgr;
- BiomeManager *biomemgr = getServer(L)->getEmergeManager()->biomemgr;
- SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr;
+ EmergeManager *emerge = getServer(L)->getEmergeManager();
+ DecorationManager *decomgr = emerge->getWritableDecorationManager();
+ BiomeManager *biomemgr = emerge->getWritableBiomeManager();
+ SchematicManager *schemmgr = emerge->getWritableSchematicManager();
enum DecorationType decotype = (DecorationType)getenumfield(L, index,
"deco_type", es_DecorationType, -1);
luaL_checktype(L, index, LUA_TTABLE);
const NodeDefManager *ndef = getServer(L)->getNodeDefManager();
- BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
- OreManager *oremgr = getServer(L)->getEmergeManager()->oremgr;
+ EmergeManager *emerge = getServer(L)->getEmergeManager();
+ BiomeManager *bmgr = emerge->getWritableBiomeManager();
+ OreManager *oremgr = emerge->getWritableOreManager();
enum OreType oretype = (OreType)getenumfield(L, index,
"ore_type", es_OreType, ORE_SCATTER);
{
NO_MAP_LOCK_REQUIRED;
- SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr;
+ SchematicManager *schemmgr =
+ getServer(L)->getEmergeManager()->getWritableSchematicManager();
StringMap replace_names;
if (lua_istable(L, 2))
{
NO_MAP_LOCK_REQUIRED;
- BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
+ BiomeManager *bmgr =
+ getServer(L)->getEmergeManager()->getWritableBiomeManager();
bmgr->clear();
return 0;
}
{
NO_MAP_LOCK_REQUIRED;
- DecorationManager *dmgr = getServer(L)->getEmergeManager()->decomgr;
+ DecorationManager *dmgr =
+ getServer(L)->getEmergeManager()->getWritableDecorationManager();
dmgr->clear();
return 0;
}
{
NO_MAP_LOCK_REQUIRED;
- OreManager *omgr = getServer(L)->getEmergeManager()->oremgr;
+ OreManager *omgr =
+ getServer(L)->getEmergeManager()->getWritableOreManager();
omgr->clear();
return 0;
}
{
NO_MAP_LOCK_REQUIRED;
- SchematicManager *smgr = getServer(L)->getEmergeManager()->schemmgr;
+ SchematicManager *smgr =
+ getServer(L)->getEmergeManager()->getWritableSchematicManager();
smgr->clear();
return 0;
}
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;
}
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;
}
GET_ENV_PTR;
ServerMap *map = &(env->getServerMap());
- SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr;
+ SchematicManager *schemmgr = (SchematicManager*)
+ getServer(L)->getEmergeManager()->getSchematicManager(); // FIXME FIXME
//// Read position
v3s16 p = check_v3s16(L, 1);
{
NO_MAP_LOCK_REQUIRED;
- SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr;
+ SchematicManager *schemmgr = (SchematicManager*)
+ getServer(L)->getEmergeManager()->getSchematicManager(); // FIXME FIXME
//// Read VoxelManip object
MMVManip *vm = LuaVoxelManip::checkobject(L, 1)->vm;
{
NO_MAP_LOCK_REQUIRED;
- SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr;
+ const SchematicManager *schemmgr = getServer(L)->getEmergeManager()->getSchematicManager();
//// Read options
bool use_comments = getboolfield_default(L, 3, "lua_use_comments", false);
{
NO_MAP_LOCK_REQUIRED;
- SchematicManager *schemmgr = getServer(L)->getEmergeManager()->schemmgr;
+ const SchematicManager *schemmgr =
+ getServer(L)->getEmergeManager()->getSchematicManager();
//// Read options
std::string write_yslice = getstringfield_default(L, 2, "write_yslice_prob", "all");