summaryrefslogtreecommitdiff
path: root/src/mapnode.h
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2010-11-29 10:52:07 +0200
committerPerttu Ahola <celeron55@gmail.com>2010-11-29 10:52:07 +0200
commitc707e00195f1035ae535f3fc8697af42e73190c0 (patch)
tree0e3c2553bb4726821e49dad599f64ecb5b3cec96 /src/mapnode.h
parente8fd5eb8eebbf12b0561d385ef8bc245d87e9ea6 (diff)
downloadminetest-c707e00195f1035ae535f3fc8697af42e73190c0.tar.gz
minetest-c707e00195f1035ae535f3fc8697af42e73190c0.tar.bz2
minetest-c707e00195f1035ae535f3fc8697af42e73190c0.zip
sitä sun tätä tekeillä, toimii kivasti
Diffstat (limited to 'src/mapnode.h')
-rw-r--r--src/mapnode.h46
1 files changed, 40 insertions, 6 deletions
diff --git a/src/mapnode.h b/src/mapnode.h
index 68e669161..981f36d86 100644
--- a/src/mapnode.h
+++ b/src/mapnode.h
@@ -17,10 +17,25 @@
#define MATERIALS_COUNT 256
-// This is completely ignored. It doesn't create faces with anything.
+/*
+ Ignored node.
+
+ param is used for custom information in special containers,
+ like VoxelManipulator.
+
+ Anything that stores MapNodes doesn't have to preserve parameters
+ associated with this material.
+
+ Doesn't create faces with anything and is considered being
+ out-of-map in the game map.
+*/
#define MATERIAL_IGNORE 255
-// This is the common material through which the player can walk
-// and which is transparent to light
+#define MATERIAL_IGNORE_DEFAULT_PARAM 0
+
+/*
+ The common material through which the player can walk and which
+ is transparent to light
+*/
#define MATERIAL_AIR 254
/*
@@ -63,6 +78,8 @@ enum Material
MATERIAL_GRASS_FOOTSTEPS,
MATERIAL_MESE,
+
+ MATERIAL_MUD,
// This is set to the number of the actual values in this enum
USEFUL_MATERIAL_COUNT
@@ -126,6 +143,21 @@ inline u8 face_materials(u8 m1, u8 m2)
return 2;
}
+/*
+ Returns true for materials that form the base ground that
+ follows the main heightmap
+*/
+inline bool is_ground_material(u8 m)
+{
+ return(
+ m == MATERIAL_STONE ||
+ m == MATERIAL_GRASS ||
+ m == MATERIAL_GRASS_FOOTSTEPS ||
+ m == MATERIAL_MESE ||
+ m == MATERIAL_MUD
+ );
+}
+
struct MapNode
{
//TODO: block type to differ from material
@@ -133,9 +165,6 @@ struct MapNode
// block type
u8 d;
- // Removed because light is now stored in param for air
- // f32 light;
-
/*
Misc parameter. Initialized to 0.
- For light_propagates() blocks, this is light intensity,
@@ -155,6 +184,11 @@ struct MapNode
param = a_param;
}
+ bool operator==(const MapNode &other)
+ {
+ return (d == other.d && param == other.param);
+ }
+
bool light_propagates()
{
return light_propagates_material(d);