From cea997426b7d66f5aa9f8aac5fd5b603bcaa3fb8 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 10 Jan 2014 22:22:54 +0100 Subject: Decoupled cChunkGenerator from cWorld and cRoot. Now the chunk generator can be used by other projects without depending on the two hugest structures in MCS. --- src/World.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/World.h') diff --git a/src/World.h b/src/World.h index f90ddd90f..b61708d03 100644 --- a/src/World.h +++ b/src/World.h @@ -636,6 +636,27 @@ private: virtual void Execute(void) override; } ; + + /** Implementation of the callbacks that the ChunkGenerator uses to store new chunks and interface to plugins */ + class cChunkGeneratorCallbacks : + public cChunkGenerator::cChunkSink, + public cChunkGenerator::cPluginInterface + { + cWorld * m_World; + + // cChunkSink overrides: + virtual void OnChunkGenerated (cChunkDesc & a_ChunkDesc) override; + virtual bool IsChunkValid (int a_ChunkX, int a_ChunkZ) override; + virtual bool HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) override; + + // cPluginInterface overrides: + virtual void CallHookChunkGenerating(cChunkDesc & a_ChunkDesc) override; + virtual void CallHookChunkGenerated (cChunkDesc & a_ChunkDesc) override; + + public: + cChunkGeneratorCallbacks(cWorld & a_World); + } ; + AString m_WorldName; AString m_IniFileName; @@ -714,6 +735,9 @@ private: cChunkGenerator m_Generator; + /** The callbacks that the ChunkGenerator uses to store new chunks and interface to plugins */ + cChunkGeneratorCallbacks m_GeneratorCallbacks; + cChunkSender m_ChunkSender; cLightingThread m_Lighting; cTickThread m_TickThread; -- cgit v1.2.3