From dacc8cdb3a0e824b435f9f4d98beb471f7a8be64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Doser?= Date: Fri, 25 Jan 2013 01:37:19 +0100 Subject: Include backface_culling flag in serialization format for TileDefs This way flowing liquids actually show the backface when specified to do so. Without this, TileDefs where by default initialized with backface_culling = true and never set otherwise. For backwards compatibility, an old client connected to a new server, or a new client connected to an old server will behave like before i.e., backface_culling is always true. --- src/nodedef.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/nodedef.cpp') diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 9a1145a8e..7f6c8a054 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -107,26 +107,31 @@ void NodeBox::deSerialize(std::istream &is) TileDef */ -void TileDef::serialize(std::ostream &os) const +void TileDef::serialize(std::ostream &os, u16 protocol_version) const { - writeU8(os, 0); // version + if(protocol_version >= 17) + writeU8(os, 1); + else + writeU8(os, 0); os<= 17) + writeU8(os, backface_culling); } void TileDef::deSerialize(std::istream &is) { int version = readU8(is); - if(version != 0) - throw SerializationError("unsupported TileDef version"); name = deSerializeString(is); animation.type = (TileAnimationType)readU8(is); animation.aspect_w = readU16(is); animation.aspect_h = readU16(is); animation.length = readF1000(is); + if(version >= 1) + backface_culling = readU8(is); } /* @@ -235,10 +240,10 @@ void ContentFeatures::serialize(std::ostream &os, u16 protocol_version) writeF1000(os, visual_scale); writeU8(os, 6); for(u32 i=0; i<6; i++) - tiledef[i].serialize(os); + tiledef[i].serialize(os, protocol_version); writeU8(os, CF_SPECIAL_COUNT); for(u32 i=0; i Date: Sat, 23 Mar 2013 23:15:30 +0100 Subject: Move rightclickable to the proper place --- src/nodedef.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nodedef.cpp') diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 7f6c8a054..d41df5c3b 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -275,9 +275,9 @@ void ContentFeatures::serialize(std::ostream &os, u16 protocol_version) serializeSimpleSoundSpec(sound_footstep, os); serializeSimpleSoundSpec(sound_dig, os); serializeSimpleSoundSpec(sound_dug, os); + writeU8(os, rightclickable); // Stuff below should be moved to correct place in a version that otherwise changes // the protocol version - writeU8(os, rightclickable); } void ContentFeatures::deSerialize(std::istream &is) @@ -336,12 +336,12 @@ void ContentFeatures::deSerialize(std::istream &is) deSerializeSimpleSoundSpec(sound_footstep, is); deSerializeSimpleSoundSpec(sound_dig, is); deSerializeSimpleSoundSpec(sound_dug, is); + rightclickable = readU8(is); // If you add anything here, insert it primarily inside the try-catch // block to not need to increase the version. try{ // Stuff below should be moved to correct place in a version that // otherwise changes the protocol version - rightclickable = readU8(is); }catch(SerializationError &e) {}; } -- cgit v1.2.3