]> git.lizzy.rs Git - minetest.git/blobdiff - src/mapblock.h
Fix crash when no world is selected and configure button is pressed.
[minetest.git] / src / mapblock.h
index 81e9502555e43912243f0038739ed63085b3a9ce..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"
@@ -429,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
        */
@@ -445,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);
 
        /*
@@ -545,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)