package tins2020 import ( "opslag.de/schobers/geom" "opslag.de/schobers/zntg" ) type FlowerState struct { ID string Location geom.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 geom.Point } func (s *GameState) Serialize(name string) error { path, err := UserFile(name) if err != nil { return err } return zntg.EncodeJSON(path, &s) } func (s *GameState) Deserialize(name string) error { path, err := UserFile(name) if err != nil { return err } return zntg.DecodeJSON(path, &s) } func SaveGameName() string { return "savegame.json" }