diff options
Diffstat (limited to 'src/emerge.cpp')
-rw-r--r-- | src/emerge.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/emerge.cpp b/src/emerge.cpp index e0dc5628e..32e7d9f24 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -113,13 +113,15 @@ EmergeParams::~EmergeParams() { infostream << "EmergeParams: destroying " << this << std::endl; // Delete everything that was cloned on creation of EmergeParams + delete biomegen; delete biomemgr; delete oremgr; delete decomgr; delete schemmgr; } -EmergeParams::EmergeParams(EmergeManager *parent, const BiomeManager *biomemgr, +EmergeParams::EmergeParams(EmergeManager *parent, const BiomeGen *biomegen, + const BiomeManager *biomemgr, const OreManager *oremgr, const DecorationManager *decomgr, const SchematicManager *schemmgr) : ndef(parent->ndef), @@ -129,6 +131,7 @@ EmergeParams::EmergeParams(EmergeManager *parent, const BiomeManager *biomemgr, biomemgr(biomemgr->clone()), oremgr(oremgr->clone()), decomgr(decomgr->clone()), schemmgr(schemmgr->clone()) { + this->biomegen = biomegen->clone(this->biomemgr); } //// @@ -143,6 +146,10 @@ EmergeManager::EmergeManager(Server *server) this->decomgr = new DecorationManager(server); this->schemmgr = new SchematicManager(server); + // initialized later + this->mgparams = nullptr; + this->biomegen = nullptr; + // Note that accesses to this variable are not synchronized. // This is because the *only* thread ever starting or stopping // EmergeThreads should be the ServerThread. @@ -240,9 +247,12 @@ void EmergeManager::initMapgens(MapgenParams *params) mgparams = params; + v3s16 csize = v3s16(1, 1, 1) * (params->chunksize * MAP_BLOCKSIZE); + biomegen = biomemgr->createBiomeGen(BIOMEGEN_ORIGINAL, params->bparams, csize); + for (u32 i = 0; i != m_threads.size(); i++) { - EmergeParams *p = new EmergeParams( - this, biomemgr, oremgr, decomgr, schemmgr); + EmergeParams *p = new EmergeParams(this, biomegen, + biomemgr, oremgr, decomgr, schemmgr); infostream << "EmergeManager: Created params " << p << " for thread " << i << std::endl; m_mapgens.push_back(Mapgen::createMapgen(params->mgtype, params, p)); |