]> git.lizzy.rs Git - minetest.git/blobdiff - src/mapblock.h
Add shutdown hook interface to Lua API
[minetest.git] / src / mapblock.h
index 10ffc61ce181bb5c46b1b808fb8cd7079bf188f0..d56d93ddae8e41c5ee0b776f0411fa9445ac9fc2 100644 (file)
@@ -24,7 +24,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <jmutexautolock.h>
 #include <exception>
 #include "debug.h"
-#include "common_irrlicht.h"
+#include "irrlichttypes.h"
+#include "irr_v3d.h"
+#include "irr_aabb3d.h"
 #include "mapnode.h"
 #include "exceptions.h"
 #include "serialization.h"
@@ -34,6 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "nodemetadata.h"
 #include "nodetimer.h"
 #include "modifiedstate.h"
+#include "util/numeric.h" // getContainerPos
 
 class Map;
 class NodeMetadataList;
@@ -428,6 +431,42 @@ class MapBlock /*: public NodeContainer*/
                return m_usage_timer;
        }
 
+       /*
+               See m_refcount
+       */
+       void refGrab()
+       {
+               m_refcount++;
+       }
+       void refDrop()
+       {
+               m_refcount--;
+       }
+       int refGet()
+       {
+               return m_refcount;
+       }
+       
+       /*
+               Node Timers
+       */
+       // Get timer
+       NodeTimer getNodeTimer(v3s16 p){ 
+               return m_node_timers.get(p);
+       }
+       // Deletes timer
+       void removeNodeTimer(v3s16 p){
+               m_node_timers.remove(p);
+       }
+       // Deletes old timer and sets a new one
+       void setNodeTimer(v3s16 p, NodeTimer t){
+               m_node_timers.set(p,t);
+       }
+       // Deletes all timers
+       void clearNodeTimers(){
+               m_node_timers.clear();
+       }
+
        /*
                Serialization
        */
@@ -444,7 +483,6 @@ class MapBlock /*: public NodeContainer*/
                Private methods
        */
 
-       void serialize_pre22(std::ostream &os, u8 version, bool disk);
        void deSerialize_pre22(std::istream &is, u8 version, bool disk);
 
        /*
@@ -544,6 +582,12 @@ class MapBlock /*: public NodeContainer*/
                Map will unload the block when this reaches a timeout.
        */
        float m_usage_timer;
+
+       /*
+               Reference count; currently used for determining if this block is in
+               the list of blocks to be drawn.
+       */
+       int m_refcount;
 };
 
 inline bool blockpos_over_limit(v3s16 p)