aboutsummaryrefslogtreecommitdiff
path: root/src/mapnode.cpp
diff options
context:
space:
mode:
authorNils Dagsson Moskopp <nils@dieweltistgarnichtso.net>2011-07-22 20:16:58 +0200
committerNils Dagsson Moskopp <nils@dieweltistgarnichtso.net>2011-07-22 20:16:58 +0200
commit7985d746f97ce1b37b6ca48a8a3e7ed70d02e4b0 (patch)
tree503647a4d173e9bd29dd489310dedb0db37088ff /src/mapnode.cpp
parenta45f287ae1b96742dfd03a01e0b558385e7b1384 (diff)
parentf706644a50b9bc62de39f571b044c7f7c55078e4 (diff)
downloadminetest-7985d746f97ce1b37b6ca48a8a3e7ed70d02e4b0.tar.gz
minetest-7985d746f97ce1b37b6ca48a8a3e7ed70d02e4b0.tar.bz2
minetest-7985d746f97ce1b37b6ca48a8a3e7ed70d02e4b0.zip
Merge branch 'upstream/master'
Diffstat (limited to 'src/mapnode.cpp')
-rw-r--r--src/mapnode.cpp42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/mapnode.cpp b/src/mapnode.cpp
index 391e593f9..1e9b64989 100644
--- a/src/mapnode.cpp
+++ b/src/mapnode.cpp
@@ -142,8 +142,10 @@ void init_mapnode()
Initially set every block to be shown as an unknown block.
Don't touch CONTENT_IGNORE or CONTENT_AIR.
*/
- for(u16 i=0; i<=253; i++)
+ for(u16 i=0; i<256; i++)
{
+ if(i == CONTENT_IGNORE || i == CONTENT_AIR)
+ continue;
ContentFeatures *f = &g_content_features[i];
f->setAllTextures("unknown_block.png");
f->dug_item = std::string("MaterialItem ")+itos(i)+" 1";
@@ -265,10 +267,10 @@ void MapNode::serialize(u8 *dest, u8 version)
{
// In these versions, CONTENT_IGNORE and CONTENT_AIR
// are 255 and 254
- if(d == CONTENT_IGNORE)
- d = 255;
- else if(d == CONTENT_AIR)
- d = 254;
+ if(actual_d == CONTENT_IGNORE)
+ actual_d = 255;
+ else if(actual_d == CONTENT_AIR)
+ actual_d = 254;
}
if(version == 0)
@@ -315,17 +317,25 @@ void MapNode::deSerialize(u8 *source, u8 version)
d = source[0];
param = source[1];
param2 = source[2];
-
- // Convert from old version to new
- if(version <= 18)
- {
- // In these versions, CONTENT_IGNORE and CONTENT_AIR
- // are 255 and 254
- if(d == 255)
- d = CONTENT_IGNORE;
- else if(d == 254)
- d = CONTENT_AIR;
- }
+ }
+
+ // Convert from old version to new
+ if(version <= 18)
+ {
+ // In these versions, CONTENT_IGNORE and CONTENT_AIR
+ // are 255 and 254
+ if(d == 255)
+ d = CONTENT_IGNORE;
+ else if(d == 254)
+ d = CONTENT_AIR;
+ }
+ // version 19 is fucked up with sometimes the old values and sometimes not
+ if(version == 19)
+ {
+ if(d == 255)
+ d = CONTENT_IGNORE;
+ else if(d == 254)
+ d = CONTENT_AIR;
}
}