refactor: load/save state as ptr
This commit is contained in:
@@ -14,13 +14,13 @@ func GenerateGame(configure func(*controller.Param), races []string) (gameID uui
|
||||
}
|
||||
|
||||
// LoadState used for lock-safe loading game state and may be called concurrently.
|
||||
func LoadState(configure func(*controller.Param)) (g game.Game, err error) {
|
||||
func LoadState(configure func(*controller.Param)) (g *game.Game, err error) {
|
||||
control(configure, func(c *controller.Controller) { g, err = c.Repo.LoadStateSafe() })
|
||||
return
|
||||
}
|
||||
|
||||
// TODO: command for loading report by players (MUST be limited by router)
|
||||
func LoadReport(configure func(*controller.Param)) (g game.Game, err error) {
|
||||
func LoadReport(configure func(*controller.Param)) (g *game.Game, err error) {
|
||||
control(configure, func(c *controller.Controller) {
|
||||
c.ExecuteState(func(r controller.Repo) { g, err = c.Repo.LoadState() })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user