forked from MTSR/mapserver
mapblock size
This commit is contained in:
parent
0a702d240c
commit
8d0fcebb17
@ -1,6 +1,7 @@
|
|||||||
package mapblockparser
|
package mapblockparser
|
||||||
|
|
||||||
type MapBlock struct {
|
type MapBlock struct {
|
||||||
|
Size int `json:"size"`
|
||||||
Version byte `json:"version"`
|
Version byte `json:"version"`
|
||||||
Underground bool `json:"underground"`
|
Underground bool `json:"underground"`
|
||||||
Mapdata []byte `json:"mapdata"`
|
Mapdata []byte `json:"mapdata"`
|
||||||
|
@ -6,13 +6,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Parse(data []byte, mtime int64) (*MapBlock, error) {
|
func Parse(data []byte, mtime int64) (*MapBlock, error) {
|
||||||
mapblock := NewMapblock()
|
|
||||||
mapblock.Mtime = mtime
|
|
||||||
|
|
||||||
if len(data) == 0 {
|
if len(data) == 0 {
|
||||||
return nil, errors.New("no data")
|
return nil, errors.New("no data")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mapblock := NewMapblock()
|
||||||
|
mapblock.Mtime = mtime
|
||||||
|
mapblock.Size = len(data)
|
||||||
|
|
||||||
offset := 0
|
offset := 0
|
||||||
|
|
||||||
// version
|
// version
|
||||||
|
@ -11,9 +11,9 @@ type MapData struct {
|
|||||||
//block position
|
//block position
|
||||||
X, Y, Z int
|
X, Y, Z int
|
||||||
|
|
||||||
Type string
|
Type string
|
||||||
Data string
|
Data string
|
||||||
Mtime int64
|
Mtime int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type SearchQuery struct {
|
type SearchQuery struct {
|
||||||
|
@ -12,7 +12,7 @@ type ClearMapData struct {
|
|||||||
|
|
||||||
func (this *ClearMapData) OnParsedMapBlock(block *mapblockparser.MapBlock, pos coords.MapBlockCoords) {
|
func (this *ClearMapData) OnParsedMapBlock(block *mapblockparser.MapBlock, pos coords.MapBlockCoords) {
|
||||||
err := this.db.RemoveMapData(pos)
|
err := this.db.RemoveMapData(pos)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ type POI struct {
|
|||||||
|
|
||||||
func (this *POI) OnParsedMapBlock(block *mapblockparser.MapBlock, pos coords.MapBlockCoords) {
|
func (this *POI) OnParsedMapBlock(block *mapblockparser.MapBlock, pos coords.MapBlockCoords) {
|
||||||
var found bool
|
var found bool
|
||||||
for _, v := range(block.BlockMapping) {
|
for _, v := range block.BlockMapping {
|
||||||
if v == "mapserver:poi" {
|
if v == "mapserver:poi" {
|
||||||
found = true
|
found = true
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user