diff options
author | paramat <mat.gregory@virginmedia.com> | 2017-01-29 06:29:40 +0000 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2017-01-30 16:38:28 +0000 |
commit | cdc538e0a242167cd7031d40670d2d4464b87f2c (patch) | |
tree | 2d635b2d559cf9828b7f8464f7dc268a7b5b972a /src/nodedef.cpp | |
parent | e761b9f48626db2af8b62a0cf85691208951cf0d (diff) | |
download | minetest-cdc538e0a242167cd7031d40670d2d4464b87f2c.tar.gz minetest-cdc538e0a242167cd7031d40670d2d4464b87f2c.tar.bz2 minetest-cdc538e0a242167cd7031d40670d2d4464b87f2c.zip |
Plantlike visual scale: Send sqrt(visual_scale) to old clients
Keep compatibility with protocol < 30 clients now that visual_scale
is no longer applied twice to plantlike drawtype and mods are being
updated to a new value.
Diffstat (limited to 'src/nodedef.cpp')
-rw-r--r-- | src/nodedef.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 0bb150267..c717b62b9 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -1611,6 +1611,10 @@ void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version) const compatible_param_type_2 = CPT2_WALLMOUNTED; } + float compatible_visual_scale = visual_scale; + if (protocol_version < 30 && drawtype == NDT_PLANTLIKE) + compatible_visual_scale = sqrt(visual_scale); + if (protocol_version == 13) { writeU8(os, 5); // version @@ -1622,7 +1626,7 @@ void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version) const writeS16(os, i->second); } writeU8(os, drawtype); - writeF1000(os, visual_scale); + writeF1000(os, compatible_visual_scale); writeU8(os, 6); for (u32 i = 0; i < 6; i++) tiledef[i].serialize(os, protocol_version); @@ -1670,7 +1674,7 @@ void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version) const writeS16(os, i->second); } writeU8(os, drawtype); - writeF1000(os, visual_scale); + writeF1000(os, compatible_visual_scale); writeU8(os, 6); for (u32 i = 0; i < 6; i++) tiledef[i].serialize(os, protocol_version); @@ -1724,7 +1728,7 @@ void ContentFeatures::serializeOld(std::ostream &os, u16 protocol_version) const writeS16(os, i->second); } writeU8(os, drawtype); - writeF1000(os, visual_scale); + writeF1000(os, compatible_visual_scale); writeU8(os, 6); for (u32 i = 0; i < 6; i++) tiledef[i].serialize(os, protocol_version); |