]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/map.h
Merge branch 'master' of https://github.com/minetest/minetest
[dragonfireclient.git] / src / map.h
index da55fb432234f42b119262ddaa3d6e35dc3e81df..e0db2e2627a01c4345df8978d90e895a4a43e784 100644 (file)
--- a/src/map.h
+++ b/src/map.h
@@ -31,6 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "voxel.h"
 #include "modifiedstate.h"
 #include "util/container.h"
+#include "util/metricsbackend.h"
 #include "nodetimer.h"
 #include "map_settings_manager.h"
 #include "debug.h"
@@ -45,6 +46,7 @@ class NodeMetadata;
 class IGameDef;
 class IRollbackManager;
 class EmergeManager;
+class MetricsBackend;
 class ServerEnvironment;
 struct BlockMakeData;
 
@@ -121,7 +123,7 @@ class Map /*: public NodeContainer*/
 {
 public:
 
-       Map(std::ostream &dout, IGameDef *gamedef);
+       Map(IGameDef *gamedef);
        virtual ~Map();
        DISABLE_CLASS_COPY(Map);
 
@@ -147,8 +149,6 @@ class Map /*: public NodeContainer*/
        MapSector * getSectorNoGenerateNoLock(v2s16 p2d);
        // Same as the above (there exists no lock anymore)
        MapSector * getSectorNoGenerate(v2s16 p2d);
-       // Gets an existing sector or creates an empty one
-       //MapSector * getSectorCreate(v2s16 p2d);
 
        /*
                This is overloaded by ClientMap and ServerMap to allow
@@ -160,7 +160,9 @@ class Map /*: public NodeContainer*/
        MapBlock * getBlockNoCreate(v3s16 p);
        // Returns NULL if not found
        MapBlock * getBlockNoCreateNoEx(v3s16 p);
-
+       
+       void listAllLoadedBlocks(std::vector<v3s16> &dst);
+       
        /* Server overrides */
        virtual MapBlock * emergeBlock(v3s16 p, bool create_blank=true)
        { return getBlockNoCreateNoEx(p); }
@@ -266,11 +268,6 @@ class Map /*: public NodeContainer*/
        void setNodeTimer(const NodeTimer &t);
        void removeNodeTimer(v3s16 p);
 
-       /*
-               Misc.
-       */
-       std::map<v2s16, MapSector*> *getSectorsPtr(){return &m_sectors;}
-
        /*
                Variables
        */
@@ -281,8 +278,6 @@ class Map /*: public NodeContainer*/
 protected:
        friend class LuaVoxelManip;
 
-       std::ostream &m_dout; // A bit deprecated, could be removed
-
        IGameDef *m_gamedef;
 
        std::set<MapEventReceiver*> m_event_receivers;
@@ -324,7 +319,7 @@ class ServerMap : public Map
        /*
                savedir: directory to which map data should be saved
        */
-       ServerMap(const std::string &savedir, IGameDef *gamedef, EmergeManager *emerge);
+       ServerMap(const std::string &savedir, IGameDef *gamedef, EmergeManager *emerge, MetricsBackend *mb);
        ~ServerMap();
 
        s32 mapType() const
@@ -372,15 +367,6 @@ class ServerMap : public Map
        */
        MapBlock *getBlockOrEmerge(v3s16 p3d);
 
-       // Helper for placing objects on ground level
-       s16 findGroundLevel(v2s16 p2d);
-
-       /*
-               Misc. helper functions for fiddling with directory and file
-               names when saving
-       */
-       void createDirs(const std::string &path);
-
        /*
                Database functions
        */
@@ -392,12 +378,11 @@ class ServerMap : public Map
 
        void save(ModifiedState save_level);
        void listAllLoadableBlocks(std::vector<v3s16> &dst);
-       void listAllLoadedBlocks(std::vector<v3s16> &dst);
 
        MapgenParams *getMapgenParams();
 
        bool saveBlock(MapBlock *block);
-       static bool saveBlock(MapBlock *block, MapDatabase *db);
+       static bool saveBlock(MapBlock *block, MapDatabase *db, int compression_level = -1);
        MapBlock* loadBlock(v3s16 p);
        // Database version
        void loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool save_after_load=false);
@@ -412,7 +397,6 @@ class ServerMap : public Map
        bool isSavingEnabled(){ return m_map_saving_enabled; }
 
        u64 getSeed();
-       s16 getWaterLevel();
 
        /*!
         * Fixes lighting in one map block.
@@ -433,13 +417,9 @@ class ServerMap : public Map
        std::string m_savedir;
        bool m_map_saving_enabled;
 
-#if 0
-       // Chunk size in MapSectors
-       // If 0, chunks are disabled.
-       s16 m_chunksize;
-       // Chunks
-       core::map<v2s16, MapChunk*> m_chunks;
-#endif
+       int m_map_compression_level;
+
+       std::set<v3s16> m_chunks_in_progress;
 
        /*
                Metadata is re-written on disk only if this is true.
@@ -448,6 +428,8 @@ class ServerMap : public Map
        bool m_map_metadata_changed = true;
        MapDatabase *dbase = nullptr;
        MapDatabase *dbase_ro = nullptr;
+
+       MetricCounterPtr m_save_time_counter;
 };