aboutsummaryrefslogtreecommitdiff
path: root/src/mapnode.h
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-10-12 13:53:38 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-10-12 13:53:38 +0300
commit9e46cbf7ea512330f35d0f2ede0c7c0c085c7cf4 (patch)
treef937a97b67b5ecd0ee65ed9a845e6e4a640bb629 /src/mapnode.h
parentb60b58b627f078faba002401d300b522e0077efc (diff)
downloadminetest-9e46cbf7ea512330f35d0f2ede0c7c0c085c7cf4.tar.gz
minetest-9e46cbf7ea512330f35d0f2ede0c7c0c085c7cf4.tar.bz2
minetest-9e46cbf7ea512330f35d0f2ede0c7c0c085c7cf4.zip
Header file tweaking; mainly for speed
Diffstat (limited to 'src/mapnode.h')
-rw-r--r--src/mapnode.h69
1 files changed, 47 insertions, 22 deletions
diff --git a/src/mapnode.h b/src/mapnode.h
index e99407f86..5db337949 100644
--- a/src/mapnode.h
+++ b/src/mapnode.h
@@ -23,11 +23,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <iostream>
#include "common_irrlicht.h"
#include "light.h"
-#include "utility.h"
#include "exceptions.h"
#include "serialization.h"
-#include "tile.h"
#include "materials.h"
+#ifndef SERVER
+#include "tile.h"
+#endif
/*
Naming scheme:
@@ -101,9 +102,7 @@ class NodeMetadata;
struct ContentFeatures
{
- // Type of MapNode::param1
- ContentParamType param_type;
-
+#ifndef SERVER
/*
0: up
1: down
@@ -115,7 +114,18 @@ struct ContentFeatures
TileSpec tiles[6];
video::ITexture *inventory_texture;
-
+
+ // Used currently for flowing liquids
+ u8 vertex_alpha;
+ // Post effect color, drawn when the camera is inside the node.
+ video::SColor post_effect_color;
+ // Special irrlicht material, used sometimes
+ video::SMaterial *special_material;
+ AtlasPointer *special_atlas;
+#endif
+
+ // Type of MapNode::param1
+ ContentParamType param_type;
// True for all ground-like things like stone and mud, false for eg. trees
bool is_ground_content;
bool light_propagates;
@@ -146,10 +156,10 @@ struct ContentFeatures
// Mineral overrides this.
std::string dug_item;
- // Extra dug item and its rarity
- std::string extra_dug_item;
- s32 extra_dug_item_rarity;
-
+ // Extra dug item and its rarity
+ std::string extra_dug_item;
+ s32 extra_dug_item_rarity;
+
// Initial metadata is cloned from this
NodeMetadata *initial_metadata;
@@ -162,13 +172,6 @@ struct ContentFeatures
// 1 giving almost instantaneous propagation and 7 being
// the slowest possible
u8 liquid_viscosity;
- // Used currently for flowing liquids
- u8 vertex_alpha;
- // Post effect color, drawn when the camera is inside the node.
- video::SColor post_effect_color;
- // Special irrlicht material, used sometimes
- video::SMaterial *special_material;
- AtlasPointer *special_atlas;
// Amount of light the node emits
u8 light_source;
@@ -182,8 +185,15 @@ struct ContentFeatures
void reset()
{
- param_type = CPT_NONE;
+#ifndef SERVER
inventory_texture = NULL;
+
+ vertex_alpha = 255;
+ post_effect_color = video::SColor(0, 0, 0, 0);
+ special_material = NULL;
+ special_atlas = NULL;
+#endif
+ param_type = CPT_NONE;
is_ground_content = false;
light_propagates = false;
sunlight_propagates = false;
@@ -202,10 +212,6 @@ struct ContentFeatures
liquid_alternative_flowing = CONTENT_IGNORE;
liquid_alternative_source = CONTENT_IGNORE;
liquid_viscosity = 0;
- vertex_alpha = 255;
- post_effect_color = video::SColor(0, 0, 0, 0);
- special_material = NULL;
- special_atlas = NULL;
light_source = 0;
digging_properties.clear();
damage_per_second = 0;
@@ -222,6 +228,12 @@ struct ContentFeatures
Quickhands for simple materials
*/
+#ifdef SERVER
+ void setTexture(u16 i, std::string name, u8 alpha=255)
+ {}
+ void setAllTextures(std::string name, u8 alpha=255)
+ {}
+#else
void setTexture(u16 i, std::string name, u8 alpha=255);
void setAllTextures(std::string name, u8 alpha=255)
@@ -233,7 +245,9 @@ struct ContentFeatures
// Force inventory texture too
setInventoryTexture(name);
}
+#endif
+#ifndef SERVER
void setTile(u16 i, const TileSpec &tile)
{
tiles[i] = tile;
@@ -245,11 +259,20 @@ struct ContentFeatures
setTile(i, tile);
}
}
+#endif
+#ifdef SERVER
+ void setInventoryTexture(std::string imgname)
+ {}
+ void setInventoryTextureCube(std::string top,
+ std::string left, std::string right)
+ {}
+#else
void setInventoryTexture(std::string imgname);
void setInventoryTextureCube(std::string top,
std::string left, std::string right);
+#endif
};
/*
@@ -632,6 +655,7 @@ struct MapNode
}
// In mapnode.cpp
+#ifndef SERVER
/*
Get tile of a face of the node.
dir: direction of face
@@ -639,6 +663,7 @@ struct MapNode
which must be obeyed so that the texture atlas can be used.
*/
TileSpec getTile(v3s16 dir);
+#endif
/*
Gets mineral content of node, if there is any.