]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/mapblock.h
Fix flipped textures for drawtype "glasslike"
[dragonfireclient.git] / src / mapblock.h
index 10ffc61ce181bb5c46b1b808fb8cd7079bf188f0..3879c5b0e5db10cb8e68cf635730fb8085972b8a 100644 (file)
@@ -1,6 +1,6 @@
 /*
-Minetest-c55
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
@@ -20,25 +20,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #ifndef MAPBLOCK_HEADER
 #define MAPBLOCK_HEADER
 
-#include <jmutex.h>
-#include <jmutexautolock.h>
-#include <exception>
+#include <set>
 #include "debug.h"
-#include "common_irrlicht.h"
+#include "irr_v3d.h"
 #include "mapnode.h"
 #include "exceptions.h"
-#include "serialization.h"
 #include "constants.h"
-#include "voxel.h"
 #include "staticobject.h"
 #include "nodemetadata.h"
 #include "nodetimer.h"
 #include "modifiedstate.h"
+#include "util/numeric.h" // getContainerPos
 
 class Map;
 class NodeMetadataList;
 class IGameDef;
 class MapBlockMesh;
+class VoxelManipulator;
 
 #define BLOCK_TIMESTAMP_UNDEFINED 0xffffffff
 
@@ -349,7 +347,7 @@ class MapBlock /*: public NodeContainer*/
        }
 
        // See comments in mapblock.cpp
-       bool propagateSunlight(core::map<v3s16, bool> & light_sources,
+       bool propagateSunlight(std::set<v3s16> & light_sources,
                        bool remove_light=false, bool *black_air_left=NULL);
        
        // Copies data to VoxelManipulator to getPosRelative()
@@ -428,6 +426,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
        */
@@ -439,12 +473,14 @@ class MapBlock /*: public NodeContainer*/
        // unknown blocks from id-name mapping to wndef
        void deSerialize(std::istream &is, u8 version, bool disk);
 
+       void serializeNetworkSpecific(std::ostream &os, u16 net_proto_version);
+       void deSerializeNetworkSpecific(std::istream &is);
+
 private:
        /*
                Private methods
        */
 
-       void serialize_pre22(std::ostream &os, u8 version, bool disk);
        void deSerialize_pre22(std::istream &is, u8 version, bool disk);
 
        /*
@@ -472,13 +508,12 @@ class MapBlock /*: public NodeContainer*/
 
 #ifndef SERVER // Only on client
        MapBlockMesh *mesh;
-       //JMutex mesh_mutex;
 #endif
        
        NodeMetadataList m_node_metadata;
        NodeTimerList m_node_timers;
        StaticObjectList m_static_objects;
-       
+
 private:
        /*
                Private member variables
@@ -544,6 +579,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)