]> git.lizzy.rs Git - minetest.git/blobdiff - src/emerge.h
Do not allow the m_transforming_liquid queue to increase until all RAM is consumed
[minetest.git] / src / emerge.h
index 14a2728baa457c264a8ffecae8336c98f4c2d003..7de1c8391d9c309b21f2b503107bc91d41c94c00 100644 (file)
@@ -23,8 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <map>
 #include "irr_v3d.h"
 #include "util/container.h"
-#include "map.h" // for ManualMapVoxelManipulator
 #include "mapgen.h" // for MapgenParams
+#include "map.h"
 
 #define MGPARAMS_SET_MGNAME      1
 #define MGPARAMS_SET_SEED        2
@@ -34,19 +34,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #define BLOCK_EMERGE_ALLOWGEN (1<<0)
 
 #define EMERGE_DBG_OUT(x) \
-       { if (enable_mapgen_debug_info) \
-       infostream << "EmergeThread: " x << std::endl; }
+       do {                                                   \
+               if (enable_mapgen_debug_info)                      \
+                       infostream << "EmergeThread: " x << std::endl; \
+       } while (0)
 
 class EmergeThread;
-//class Mapgen;
-//struct MapgenFactory;
-class Biome;
-class BiomeDefManager;
-class Decoration;
-class Ore;
 class INodeDefManager;
 class Settings;
 
+class BiomeManager;
+class OreManager;
+class DecorationManager;
+class SchematicManager;
+
 struct BlockMakeData {
        ManualMapVoxelManipulator *vmanip;
        u64 seed;
@@ -70,15 +71,7 @@ struct BlockEmergeData {
        u8 flags;
 };
 
-class IBackgroundBlockEmerger
-{
-public:
-       virtual bool enqueueBlockEmerge(u16 peer_id, v3s16 p,
-                       bool allow_generate) = 0;
-       virtual ~IBackgroundBlockEmerger() {}
-};
-
-class EmergeManager : public IBackgroundBlockEmerger {
+class EmergeManager {
 public:
        INodeDefManager *ndef;
 
@@ -96,25 +89,29 @@ class EmergeManager : public IBackgroundBlockEmerger {
        u16 qlimit_diskonly;
        u16 qlimit_generate;
 
-       u32 gennotify;
+       u32 gen_notify_on;
+       std::set<u32> gen_notify_on_deco_ids;
 
-       //block emerge queue data structures
+       //// Block emerge queue data structures
        JMutex queuemutex;
        std::map<v3s16, BlockEmergeData *> blocks_enqueued;
        std::map<u16, u16> peer_queue_count;
 
-       //Mapgen-related structures
-       BiomeDefManager *biomedef;
-       std::vector<Ore *> ores;
-       std::vector<Decoration *> decorations;
+       //// Managers of map generation-related components
+       BiomeManager *biomemgr;
+       OreManager *oremgr;
+       DecorationManager *decomgr;
+       SchematicManager *schemmgr;
 
+       //// Methods
        EmergeManager(IGameDef *gamedef);
        ~EmergeManager();
 
+       void loadMapgenParams();
        void initMapgens();
        Mapgen *getCurrentMapgen();
        Mapgen *createMapgen(std::string mgname, int mgid,
-                                               MapgenParams *mgparams);
+               MapgenParams *mgparams);
        MapgenSpecificParams *createMapgenParams(std::string mgname);
        void startThreads();
        void stopThreads();