1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Bump minimal protocol version to 36 (#6319)

* Bump minimal protocol version to 36
Item/Node/TileDef, NodeBox, TileAnimation: Remove old compat code

* Accept future serialisation versions
This commit is contained in:
SmallJoker 2017-08-29 19:26:55 +02:00 committed by Loïc Blot
parent 1b3e4e1736
commit b7ee608e70
9 changed files with 136 additions and 503 deletions

View file

@ -19,23 +19,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "tileanimation.h"
#include "util/serialize.h"
void TileAnimationParams::serialize(std::ostream &os, u16 protocol_version) const
void TileAnimationParams::serialize(std::ostream &os, u8 tiledef_version) const
{
if (protocol_version < 29) {
if (type == TAT_VERTICAL_FRAMES) {
writeU8(os, type);
writeU16(os, vertical_frames.aspect_w);
writeU16(os, vertical_frames.aspect_h);
writeF1000(os, vertical_frames.length);
} else {
writeU8(os, TAT_NONE);
writeU16(os, 1);
writeU16(os, 1);
writeF1000(os, 1.0);
}
return;
}
writeU8(os, type);
if (type == TAT_VERTICAL_FRAMES) {
writeU16(os, vertical_frames.aspect_w);
@ -48,15 +33,9 @@ void TileAnimationParams::serialize(std::ostream &os, u16 protocol_version) cons
}
}
void TileAnimationParams::deSerialize(std::istream &is, u16 protocol_version)
void TileAnimationParams::deSerialize(std::istream &is, u8 tiledef_version)
{
type = (TileAnimationType) readU8(is);
if (protocol_version < 29) {
vertical_frames.aspect_w = readU16(is);
vertical_frames.aspect_h = readU16(is);
vertical_frames.length = readF1000(is);
return;
}
if (type == TAT_VERTICAL_FRAMES) {
vertical_frames.aspect_w = readU16(is);