forked from MTSR/mapserver
mapblock compat
see PR: https://github.com/thomasrudin-mt/minetest-tile-server/pull/46 Previous issue: https://github.com/thomasrudin-mt/minetest-tile-server/issues/7
This commit is contained in:
parent
d8b55b4cf8
commit
320d8bf528
@ -21,6 +21,10 @@ func Parse(data []byte, mtime int64, pos coords.MapBlockCoords) (*MapBlock, erro
|
|||||||
// version
|
// version
|
||||||
mapblock.Version = data[0]
|
mapblock.Version = data[0]
|
||||||
|
|
||||||
|
if mapblock.Version < 25 || mapblock.Version > 28 {
|
||||||
|
return nil, errors.New("mapblock-version not supported: " + strconv.Itoa(int(mapblock.Version)))
|
||||||
|
}
|
||||||
|
|
||||||
//flags
|
//flags
|
||||||
flags := data[1]
|
flags := data[1]
|
||||||
mapblock.Underground = (flags & 0x01) == 0x01
|
mapblock.Underground = (flags & 0x01) == 0x01
|
||||||
@ -37,8 +41,14 @@ func Parse(data []byte, mtime int64, pos coords.MapBlockCoords) (*MapBlock, erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
//mapdata (blocks)
|
//mapdata (blocks)
|
||||||
|
if mapblock.Version >= 27 {
|
||||||
offset = 6
|
offset = 6
|
||||||
|
|
||||||
|
} else {
|
||||||
|
offset = 4
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//metadata
|
//metadata
|
||||||
count, err := parseMapdata(mapblock, data[offset:])
|
count, err := parseMapdata(mapblock, data[offset:])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user