Copyright (C) 2010 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 General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+GNU Lesser General Public License for more details.
-You should have received a copy of the GNU General Public License along
+You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#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"
#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;
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
*/
Private methods
*/
- void serialize_pre22(std::ostream &os, u8 version, bool disk);
void deSerialize_pre22(std::istream &is, u8 version, bool disk);
/*
//JMutex mesh_mutex;
#endif
- NodeMetadataList *m_node_metadata;
+ NodeMetadataList m_node_metadata;
+ NodeTimerList m_node_timers;
StaticObjectList m_static_objects;
private:
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)