+ bool popBlockEmerge(v3s16 *pos, BlockEmergeData *bedata);
+
+ EmergeAction getBlockOrStartGen(
+ v3s16 pos, bool allow_gen, MapBlock **block, BlockMakeData *data);
+ MapBlock *finishGen(v3s16 pos, BlockMakeData *bmdata,
+ std::map<v3s16, MapBlock *> *modified_blocks);
+
+ friend class EmergeManager;
+};
+
+////
+//// Built-in mapgens
+////
+
+MapgenDesc g_reg_mapgens[] = {
+ {"v5", new MapgenFactoryV5, true},
+ {"v6", new MapgenFactoryV6, true},
+ {"v7", new MapgenFactoryV7, true},
+ {"fractal", new MapgenFactoryFractal, false},
+ {"singlenode", new MapgenFactorySinglenode, false},
+};
+
+////
+//// EmergeManager
+////
+
+EmergeManager::EmergeManager(IGameDef *gamedef)
+{
+ this->ndef = gamedef->getNodeDefManager();
+ this->biomemgr = new BiomeManager(gamedef);
+ this->oremgr = new OreManager(gamedef);
+ this->decomgr = new DecorationManager(gamedef);
+ this->schemmgr = new SchematicManager(gamedef);
+ this->gen_notify_on = 0;
+
+ // Note that accesses to this variable are not synchronized.
+ // This is because the *only* thread ever starting or stopping
+ // EmergeThreads should be the ServerThread.
+ this->m_threads_active = false;
+
+ enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
+
+ // If unspecified, leave a proc for the main thread and one for
+ // some other misc thread
+ s16 nthreads = 0;
+ if (!g_settings->getS16NoEx("num_emerge_threads", nthreads))
+ nthreads = Thread::getNumberOfProcessors() - 2;