Add count based unload limit for mapblocks
[oweals/minetest.git] / src / mapsector.h
index e89247a92e0d1784d4817307385cc35910de5e5f..4c1ce86a3ac6077412f58ed7546e42a478539873 100644 (file)
@@ -40,7 +40,7 @@ class IGameDef;
 class MapSector
 {
 public:
-       
+
        MapSector(Map *parent, v2s16 pos, IGameDef *gamedef);
        virtual ~MapSector();
 
@@ -58,16 +58,18 @@ public:
        MapBlock * createBlankBlock(s16 y);
 
        void insertBlock(MapBlock *block);
-       
+
        void deleteBlock(MapBlock *block);
-       
+
        void getBlocks(MapBlockVect &dest);
-       
+
+       bool empty();
+
        // Always false at the moment, because sector contains no metadata.
        bool differs_from_disk;
 
 protected:
-       
+
        // The pile of MapBlocks
        std::map<s16, MapBlock*> m_blocks;
 
@@ -76,12 +78,12 @@ protected:
        v2s16 m_pos;
 
        IGameDef *m_gamedef;
-       
+
        // Last-used block is cached here for quicker access.
-       // Be sure to set this to NULL when the cached block is deleted 
+       // Be sure to set this to NULL when the cached block is deleted
        MapBlock *m_block_cache;
        s16 m_block_cache_y;
-       
+
        /*
                Private methods
        */
@@ -94,7 +96,7 @@ class ServerMapSector : public MapSector
 public:
        ServerMapSector(Map *parent, v2s16 pos, IGameDef *gamedef);
        ~ServerMapSector();
-       
+
        u32 getId() const
        {
                return MAPSECTOR_SERVER;
@@ -106,7 +108,7 @@ public:
        */
 
        void serialize(std::ostream &os, u8 version);
-       
+
        static ServerMapSector* deSerialize(
                        std::istream &is,
                        Map *parent,
@@ -114,7 +116,7 @@ public:
                        std::map<v2s16, MapSector*> & sectors,
                        IGameDef *gamedef
                );
-               
+
 private:
 };
 
@@ -124,7 +126,7 @@ class ClientMapSector : public MapSector
 public:
        ClientMapSector(Map *parent, v2s16 pos, IGameDef *gamedef);
        ~ClientMapSector();
-       
+
        u32 getId() const
        {
                return MAPSECTOR_CLIENT;
@@ -133,6 +135,6 @@ public:
 private:
 };
 #endif
-       
+
 #endif