aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKahrl <kahrl@gmx.net>2012-01-22 14:55:55 +0100
committerPerttu Ahola <celeron55@gmail.com>2012-01-22 17:31:20 +0200
commitc241902b4085573477c996bbcdacaed2d293b38c (patch)
tree080cd28a8def6d20f564717ea4222c11d88c467c
parent4799a8f7619b1aad6f9f0c977849be81f17a3672 (diff)
downloadminetest-c241902b4085573477c996bbcdacaed2d293b38c.tar.gz
minetest-c241902b4085573477c996bbcdacaed2d293b38c.tar.bz2
minetest-c241902b4085573477c996bbcdacaed2d293b38c.zip
Cleanup (some stuff went wrong when reverting 4-byte mapnodes); fix legacy_wallmounted
-rw-r--r--src/mapblock.cpp4
-rw-r--r--src/mapnode.cpp16
-rw-r--r--src/mapnode.h2
-rw-r--r--src/nodedef.cpp2
4 files changed, 11 insertions, 13 deletions
diff --git a/src/mapblock.cpp b/src/mapblock.cpp
index fb3bbf7a7..b436378da 100644
--- a/src/mapblock.cpp
+++ b/src/mapblock.cpp
@@ -1157,28 +1157,24 @@ void MapBlock::deSerialize_pre22(std::istream &is, u8 version, bool disk)
if(nodedef->getId("default:stone") == data[i].getContent()
&& data[i].getParam1() == 1)
{
- //dstream << "legacy coal\n";
data[i].setContent(nodedef->getId("default:stone_with_coal"));
data[i].setParam1(0);
}
else if(nodedef->getId("default:stone") == data[i].getContent()
&& data[i].getParam1() == 2)
{
- //dstream << "legacy iron\n";
data[i].setContent(nodedef->getId("default:stone_with_iron"));
data[i].setParam1(0);
}
// facedir_simple
if(f.legacy_facedir_simple)
{
- dstream << "legacy_facedir_simple\n";
data[i].setParam2(data[i].getParam1());
data[i].setParam1(0);
}
// wall_mounted
if(f.legacy_wallmounted)
{
- dstream << "legacy_wallmounted\n";
u8 wallmounted_new_to_old[8] = {0x04, 0x08, 0x01, 0x02, 0x10, 0x20, 0, 0};
u8 dir_old_format = data[i].getParam2();
u8 dir_new_format = 0;
diff --git a/src/mapnode.cpp b/src/mapnode.cpp
index bfadbeac5..6cb9671b5 100644
--- a/src/mapnode.cpp
+++ b/src/mapnode.cpp
@@ -291,31 +291,31 @@ void MapNode::serialize_pre22(u8 *dest, u8 version)
// Translate to wanted version
MapNode n_foreign = mapnode_translate_from_internal(*this, version);
- u16 actual_content = n_foreign.param0;
+ u8 actual_param0 = n_foreign.param0;
// Convert special values from new version to old
if(version <= 18)
{
// In these versions, CONTENT_IGNORE and CONTENT_AIR
// are 255 and 254
- if(actual_content == CONTENT_IGNORE)
- actual_content = 255;
- else if(actual_content == CONTENT_AIR)
- actual_content = 254;
+ if(actual_param0 == CONTENT_IGNORE)
+ actual_param0 = 255;
+ else if(actual_param0 == CONTENT_AIR)
+ actual_param0 = 254;
}
if(version == 0)
{
- dest[0] = actual_content;
+ dest[0] = actual_param0;
}
else if(version <= 9)
{
- dest[0] = actual_content;
+ dest[0] = actual_param0;
dest[1] = n_foreign.param1;
}
else
{
- dest[0] = actual_content;
+ dest[0] = actual_param0;
dest[1] = n_foreign.param1;
dest[2] = n_foreign.param2;
}
diff --git a/src/mapnode.h b/src/mapnode.h
index 1c75f39c5..5e066604b 100644
--- a/src/mapnode.h
+++ b/src/mapnode.h
@@ -112,7 +112,7 @@ struct MapNode
{
param1 = a_param1;
param2 = a_param2;
- // Set content (param0 and param2&0xf0)) after other params
+ // Set content (param0 and (param2&0xf0)) after other params
// because this needs to override part of param2
setContent(content);
}
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index 3d85bdbd9..0c2793a0e 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -394,6 +394,8 @@ public:
def.param_type_2 == CPT2_FULL
||
def.param_type_2 == CPT2_FLOWINGLIQUID
+ ||
+ def.legacy_wallmounted
);
// Get some id
id = getFreeId(require_full_param2);