From: Kahrl Date: Sun, 22 Jan 2012 13:55:55 +0000 (+0100) Subject: Cleanup (some stuff went wrong when reverting 4-byte mapnodes); fix legacy_wallmounted X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=c241902b4085573477c996bbcdacaed2d293b38c;p=zefram%2Fminetest%2Fminetest_engine.git Cleanup (some stuff went wrong when reverting 4-byte mapnodes); fix legacy_wallmounted --- diff --git a/src/mapblock.cpp b/src/mapblock.cpp index fb3bbf7a..b436378d 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 bfadbeac..6cb9671b 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 1c75f39c..5e066604 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 3d85bdbd..0c2793a0 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);