layer find cleanup
This commit is contained in:
parent
16d691abf0
commit
6583d6c3a5
@ -12,19 +12,13 @@ const (
|
|||||||
func GetTileCoordsFromMapBlock(mbc *MapBlockCoords, layers []*layer.Layer) *TileCoords {
|
func GetTileCoordsFromMapBlock(mbc *MapBlockCoords, layers []*layer.Layer) *TileCoords {
|
||||||
tc := TileCoords{X: mbc.X, Y: (mbc.Z + 1) * -1, Zoom: MAX_ZOOM}
|
tc := TileCoords{X: mbc.X, Y: (mbc.Z + 1) * -1, Zoom: MAX_ZOOM}
|
||||||
|
|
||||||
var layerid *int
|
currentLayer := layer.FindLayerByY(layers, mbc.Y)
|
||||||
for _, l := range layers {
|
|
||||||
if mbc.Y >= l.From && mbc.Y <= l.To {
|
|
||||||
layerid = &l.Id
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if layerid == nil {
|
if currentLayer == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
tc.LayerId = *layerid
|
tc.LayerId = currentLayer.Id
|
||||||
|
|
||||||
return &tc
|
return &tc
|
||||||
}
|
}
|
||||||
|
@ -50,15 +50,9 @@ func (a *MapBlockAccessor) FindMapBlocksByMtime(lastmtime int64, limit int, laye
|
|||||||
result.LastMtime = block.Mtime
|
result.LastMtime = block.Mtime
|
||||||
}
|
}
|
||||||
|
|
||||||
inLayer := false
|
currentLayer := layer.FindLayerByY(layerfilter, block.Pos.Y)
|
||||||
for _, l := range layerfilter {
|
|
||||||
if block.Pos.Y >= l.From && block.Pos.Y <= l.To {
|
|
||||||
inLayer = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !inLayer {
|
if currentLayer == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user