mapblock size

This commit is contained in:
NatureFreshMilk 2019-01-18 15:18:42 +01:00
parent 0a702d240c
commit 8d0fcebb17
5 changed files with 13 additions and 11 deletions

View File

@ -1,6 +1,7 @@
package mapblockparser
type MapBlock struct {
Size int `json:"size"`
Version byte `json:"version"`
Underground bool `json:"underground"`
Mapdata []byte `json:"mapdata"`

View File

@ -6,13 +6,14 @@ import (
)
func Parse(data []byte, mtime int64) (*MapBlock, error) {
mapblock := NewMapblock()
mapblock.Mtime = mtime
if len(data) == 0 {
return nil, errors.New("no data")
}
mapblock := NewMapblock()
mapblock.Mtime = mtime
mapblock.Size = len(data)
offset := 0
// version

View File

@ -7,13 +7,13 @@ import (
type MapData struct {
//mapblock position
MBPos coords.MapBlockCoords
//block position
X, Y, Z int
Type string
Data string
Mtime int64
Type string
Data string
Mtime int64
}
type SearchQuery struct {

View File

@ -12,7 +12,7 @@ type ClearMapData struct {
func (this *ClearMapData) OnParsedMapBlock(block *mapblockparser.MapBlock, pos coords.MapBlockCoords) {
err := this.db.RemoveMapData(pos)
if err != nil {
panic(err)
}
if err != nil {
panic(err)
}
}

View File

@ -12,7 +12,7 @@ type POI struct {
func (this *POI) OnParsedMapBlock(block *mapblockparser.MapBlock, pos coords.MapBlockCoords) {
var found bool
for _, v := range(block.BlockMapping) {
for _, v := range block.BlockMapping {
if v == "mapserver:poi" {
found = true
break