package tins2020 type FlowerState struct { ID string Location Point } type GameState struct { Balance int Speed GameSpeed Herbarium HerbariumState Terrain TerrainState View ViewState } type HerbariumState struct { Flowers []HerbariumFlowerState } type HerbariumFlowerState struct { ID string Unlocked bool } type TerrainState struct { Temperature int64 Humidity int64 Variant int64 PlaceX int64 PlaceY int64 Flowers []FlowerState } type ViewState struct { Center Point } func (s *GameState) Serialize(name string) error { path, err := UserFile(name) if err != nil { return err } return EncodeJSON(path, &s) } func (s *GameState) Deserialize(name string) error { path, err := UserFile(name) if err != nil { return err } return DecodeJSON(path, &s) } func SaveGameName() string { return "savegame.json" }