onUpdate(mapblock)

This commit is contained in:
NatureFreshMilk 2019-01-21 14:42:38 +01:00
parent 563ea61e67
commit 5f14300005
3 changed files with 7 additions and 9 deletions

View File

@ -19,7 +19,7 @@ type MapBlockAccessor struct {
}
type MapBlockListener interface {
OnParsedMapBlock(block *mapblockparser.MapBlock, pos coords.MapBlockCoords)
OnParsedMapBlock(block *mapblockparser.MapBlock)
}
func getKey(pos coords.MapBlockCoords) string {
@ -82,7 +82,7 @@ func (a *MapBlockAccessor) FindLegacyMapBlocks(lastpos coords.MapBlockCoords, li
}
for _, listener := range a.listeners {
listener.OnParsedMapBlock(mapblock, block.Pos)
listener.OnParsedMapBlock(mapblock)
}
a.c.Set(key, mapblock, cache.DefaultExpiration)
@ -130,7 +130,7 @@ func (a *MapBlockAccessor) FindLatestMapBlocks(mintime int64, limit int, layerfi
}
for _, listener := range a.listeners {
listener.OnParsedMapBlock(mapblock, block.Pos)
listener.OnParsedMapBlock(mapblock)
}
a.c.Set(key, mapblock, cache.DefaultExpiration)
@ -163,7 +163,7 @@ func (a *MapBlockAccessor) GetMapBlock(pos coords.MapBlockCoords) (*mapblockpars
}
for _, listener := range a.listeners {
listener.OnParsedMapBlock(mapblock, pos)
listener.OnParsedMapBlock(mapblock)
}
a.c.Set(key, mapblock, cache.DefaultExpiration)

View File

@ -1,7 +1,6 @@
package mapobject
import (
"mapserver/coords"
"mapserver/mapblockparser"
"mapserver/mapobjectdb"
)
@ -10,8 +9,8 @@ type ClearMapData struct {
db mapobjectdb.DBAccessor
}
func (this *ClearMapData) OnParsedMapBlock(block *mapblockparser.MapBlock, pos coords.MapBlockCoords) {
err := this.db.RemoveMapData(pos)
func (this *ClearMapData) OnParsedMapBlock(block *mapblockparser.MapBlock) {
err := this.db.RemoveMapData(block.Pos)
if err != nil {
panic(err)
}

View File

@ -1,7 +1,6 @@
package mapobject
import (
"mapserver/coords"
"mapserver/mapblockparser"
"mapserver/mapobjectdb"
)
@ -10,7 +9,7 @@ type POI struct {
db mapobjectdb.DBAccessor
}
func (this *POI) OnParsedMapBlock(block *mapblockparser.MapBlock, pos coords.MapBlockCoords) {
func (this *POI) OnParsedMapBlock(block *mapblockparser.MapBlock) {
var found bool
for _, v := range block.BlockMapping {
if v == "mapserver:poi" {