19 lines
447 B
Go
19 lines
447 B
Go
|
package tiles
|
||
|
|
||
|
// Tileset stores tiles by TileID
|
||
|
type Tileset map[string]*Tile
|
||
|
|
||
|
func (tileset Tileset) GetTiledRoutes() []TiledRoute {
|
||
|
idmap := map[string]bool{}
|
||
|
result := []TiledRoute{}
|
||
|
for _, tile := range tileset {
|
||
|
for _, tr := range tile.TiledRoutes {
|
||
|
if _, ok := idmap[tr.Route.ExtraMembers.MustString("id")]; !ok {
|
||
|
idmap[tr.Route.ExtraMembers.MustString("id")] = true
|
||
|
result = append(result, tr)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return result
|
||
|
}
|