/*
-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
#ifndef MAPBLOCK_HEADER
#define MAPBLOCK_HEADER
-#include <jmutex.h>
-#include <jmutexautolock.h>
-#include <exception>
+#include <set>
#include "debug.h"
-#include "irrlichttypes.h"
#include "irr_v3d.h"
-#include "irr_aabb3d.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"
class NodeMetadataList;
class IGameDef;
class MapBlockMesh;
+class VoxelManipulator;
#define BLOCK_TIMESTAMP_UNDEFINED 0xffffffff
}
// 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()
{
return m_usage_timer;
}
+
+ /*
+ See m_refcount
+ */
+ void refGrab()
+ {
+ m_refcount++;
+ }
+ void refDrop()
+ {
+ m_refcount--;
+ }
+ int refGet()
+ {
+ return m_refcount;
+ }
/*
Node Timers
// 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);
/*
#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
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)