]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/map.h
Fix two reconnect bugs
[dragonfireclient.git] / src / map.h
index f4ea54f30b33994e798d6f90752106b19dc9937a..78614d2285f3310263ca5bf2813c56e9f0b6bd0c 100644 (file)
--- a/src/map.h
+++ b/src/map.h
@@ -34,6 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "util/container.h"
 #include "nodetimer.h"
 
+class Settings;
 class Database;
 class ClientMap;
 class MapSector;
@@ -262,21 +263,21 @@ class Map /*: public NodeContainer*/
        //bool updateChangedVisibleArea();
 
        // Call these before and after saving of many blocks
-       virtual void beginSave() {return;};
-       virtual void endSave() {return;};
+       virtual void beginSave() { return; }
+       virtual void endSave() { return; }
 
-       virtual void save(ModifiedState save_level){assert(0);};
+       virtual void save(ModifiedState save_level) { FATAL_ERROR("FIXME"); }
 
        // Server implements these.
        // Client leaves them as no-op.
-       virtual bool saveBlock(MapBlock *block) { return false; };
-       virtual bool deleteBlock(v3s16 blockpos) { return false; };
+       virtual bool saveBlock(MapBlock *block) { return false; }
+       virtual bool deleteBlock(v3s16 blockpos) { return false; }
 
        /*
                Updates usage timers and unloads unused blocks and sectors.
                Saves modified blocks before unloading on MAPTYPE_SERVER.
        */
-       void timerUpdate(float dtime, float unload_timeout,
+       void timerUpdate(float dtime, float unload_timeout, u32 max_loaded_blocks,
                        std::vector<v3s16> *unloaded_blocks=NULL);
 
        /*
@@ -288,17 +289,7 @@ class Map /*: public NodeContainer*/
        // Deletes sectors and their blocks from memory
        // Takes cache into account
        // If deleted sector is in sector cache, clears cache
-       void deleteSectors(std::list<v2s16> &list);
-
-#if 0
-       /*
-               Unload unused data
-               = flush changed to disk and delete from memory, if usage timer of
-                 block is more than timeout
-       */
-       void unloadUnusedData(float timeout,
-                       core::list<v3s16> *deleted_blocks=NULL);
-#endif
+       void deleteSectors(std::vector<v2s16> &list);
 
        // For debug printing. Prints "Map: ", "ServerMap: " or "ClientMap: "
        virtual void PrintInfo(std::ostream &out);
@@ -310,7 +301,8 @@ class Map /*: public NodeContainer*/
                These are basically coordinate wrappers to MapBlock
        */
 
-       NodeMetadata* getNodeMetadata(v3s16 p);
+       std::vector<v3s16> findNodesWithMetadata(v3s16 p1, v3s16 p2);
+       NodeMetadata *getNodeMetadata(v3s16 p);
 
        /**
         * Sets metadata for a node.
@@ -373,6 +365,8 @@ class Map /*: public NodeContainer*/
        u32 m_unprocessed_count;
        u32 m_inc_trending_up_start_time; // milliseconds
        bool m_queue_size_timer_started;
+
+       DISABLE_CLASS_COPY(Map);
 };
 
 /*
@@ -401,21 +395,21 @@ class ServerMap : public Map
                - Check disk (doesn't load blocks)
                - Create blank one
        */
-       ServerMapSector * createSector(v2s16 p);
+       ServerMapSector *createSector(v2s16 p);
 
        /*
                Blocks are generated by using these and makeBlock().
        */
-       bool initBlockMake(BlockMakeData *data, v3s16 blockpos);
+       bool initBlockMake(v3s16 blockpos, BlockMakeData *data);
        void finishBlockMake(BlockMakeData *data,
-                       std::map<v3s16, MapBlock*> &changed_blocks);
+               std::map<v3s16, MapBlock*> *changed_blocks);
 
        /*
                Get a block from somewhere.
                - Memory
                - Create blank
        */
-       MapBlock * createBlock(v3s16 p);
+       MapBlock *createBlock(v3s16 p);
 
        /*
                Forcefully get a block from somewhere.
@@ -455,6 +449,7 @@ class ServerMap : public Map
        /*
                Database functions
        */
+       static Database *createDatabase(const std::string &name, const std::string &savedir, Settings &conf);
        // Verify we can read/write to the database
        void verifyDatabase();
 
@@ -491,8 +486,8 @@ class ServerMap : public Map
        // Returns true if sector now resides in memory
        //bool deFlushSector(v2s16 p2d);
 
-       bool saveBlock(MapBlock *block, Database *db);
        bool saveBlock(MapBlock *block);
+       static bool saveBlock(MapBlock *block, Database *db);
        // This will generate a sector with getSector if not found.
        void loadBlock(std::string sectordir, std::string blockfile, MapSector *sector, bool save_after_load=false);
        MapBlock* loadBlock(v3s16 p);