diff options
Diffstat (limited to 'src/emerge.h')
-rw-r--r-- | src/emerge.h | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/src/emerge.h b/src/emerge.h index df849e542..ab9fca2ba 100644 --- a/src/emerge.h +++ b/src/emerge.h @@ -86,6 +86,30 @@ struct BlockEmergeData { 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; @@ -106,17 +130,22 @@ public: // 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(); @@ -160,6 +189,13 @@ private: 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(); |