From a643c8b00ad182d14ac04060ce6f11e9a6bf7e66 Mon Sep 17 00:00:00 2001 From: S Godin Date: Mon, 13 Jan 2020 12:14:04 +0000 Subject: [PATCH] update version checking --- mapblockparser/metadata.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mapblockparser/metadata.go b/mapblockparser/metadata.go index 2387d12..d52f075 100644 --- a/mapblockparser/metadata.go +++ b/mapblockparser/metadata.go @@ -69,10 +69,6 @@ func parseMetadata(mapblock *MapBlock, data []byte) (int, error) { return cr.Count, nil } - if version != 2 { - return 0, errors.New("Wrong metadata version: " + strconv.Itoa(int(version))) - } - offset++ count := readU16(metadata, offset) @@ -106,7 +102,15 @@ func parseMetadata(mapblock *MapBlock, data []byte) (int, error) { pairsMap[key] = value - offset++ + priv := 0 + if version >=2 { /* private tag doesn't exist in version=1 */ + priv = readU8(metadata, offset) + offset ++ + } + if priv != 0 { + // do something usefull + logrus.Info ("Private items in Inventory") + } } var currentInventoryName *string