summaryrefslogtreecommitdiff
path: root/src/mapnode.h
diff options
context:
space:
mode:
authordarkrose <lisa@ltmnet.com>2012-07-18 05:04:38 +1000
committerPerttu Ahola <celeron55@gmail.com>2012-07-23 08:18:39 +0300
commitea62ee4b61371107ef3d693bda4c410ba02ca7e6 (patch)
treecb80545ee9885ed7d2a577bf176f253e9bc91897 /src/mapnode.h
parentcd6becd442a50a6e2f7129108e1c2c495f885764 (diff)
downloadminetest-ea62ee4b61371107ef3d693bda4c410ba02ca7e6.tar.gz
minetest-ea62ee4b61371107ef3d693bda4c410ba02ca7e6.tar.bz2
minetest-ea62ee4b61371107ef3d693bda4c410ba02ca7e6.zip
Increase node id/param0 to 16 bits, leaving param2 always with 8 bits
Diffstat (limited to 'src/mapnode.h')
-rw-r--r--src/mapnode.h39
1 files changed, 7 insertions, 32 deletions
diff --git a/src/mapnode.h b/src/mapnode.h
index 751563135..fe656fa5c 100644
--- a/src/mapnode.h
+++ b/src/mapnode.h
@@ -85,9 +85,9 @@ struct MapNode
/*
Main content
0x00-0x7f: Short content type
- 0x80-0xff: Long content type (param2>>4 makes up low bytes)
+ 0x80-0xff: Long content type
*/
- u8 param0;
+ u16 param0;
/*
Misc parameter. Initialized to 0.
@@ -102,7 +102,6 @@ struct MapNode
/*
The second parameter. Initialized to 0.
E.g. direction for torches and flowing water.
- If param0 >= 0x80, bits 0xf0 of this is extended content type data
*/
u8 param2;
@@ -113,11 +112,9 @@ struct MapNode
MapNode(content_t content=CONTENT_AIR, u8 a_param1=0, u8 a_param2=0)
{
+ param0 = content;
param1 = a_param1;
param2 = a_param2;
- // Set content (param0 and (param2&0xf0)) after other params
- // because this needs to override part of param2
- setContent(content);
}
// Create directly from a nodename
@@ -135,25 +132,11 @@ struct MapNode
// To be used everywhere
content_t getContent() const
{
- if(param0 < 0x80)
- return param0;
- else
- return (param0<<4) + (param2>>4);
+ return param0;
}
void setContent(content_t c)
{
- if(c < 0x80)
- {
- if(param0 >= 0x80)
- param2 &= ~(0xf0);
- param0 = c;
- }
- else
- {
- param0 = c>>4;
- param2 &= ~(0xf0);
- param2 |= (c&0x0f)<<4;
- }
+ param0 = c;
}
u8 getParam1() const
{
@@ -165,19 +148,11 @@ struct MapNode
}
u8 getParam2() const
{
- if(param0 < 0x80)
- return param2;
- else
- return param2 & 0x0f;
+ return param2;
}
void setParam2(u8 p)
{
- if(param0 < 0x80)
- param2 = p;
- else{
- param2 &= 0xf0;
- param2 |= (p&0x0f);
- }
+ param2 = p;
}
void setLight(enum LightBank bank, u8 a_light, INodeDefManager *nodemgr);