spacetea/simulator/landmark.go

39 lines
706 B
Go
Raw Permalink Normal View History

2022-08-22 18:39:41 -04:00
package simulator
import (
"strconv"
"github.com/BurntSushi/toml"
)
//LandmarkID is a landmark
type LandmarkID int
//Landmark is a flavour location
type Landmark struct {
2022-08-22 19:00:15 -04:00
LandmarkID LandmarkID `toml:"landmarkid"`
2022-08-22 18:39:41 -04:00
Name string `toml:"title"`
Content string `toml:"content"`
Links []LandmarkID `toml:"links"`
}
func (l Landmark) ID() string {
return strconv.Itoa(int(l.LandmarkID))
}
//GlobalPages is a list of all pages
var GlobalLandmarks []Landmark
type landmarks struct {
Landmark []Landmark
}
func loadLandmarks(filename string) {
var res landmarks
_, err := toml.DecodeFile(filename, &res)
if err != nil {
panic(err)
}
GlobalLandmarks = res.Landmark
}