feat: turn stage increment after player's command
This commit is contained in:
@@ -2,12 +2,18 @@ package game
|
||||
|
||||
import (
|
||||
"github.com/iliadenisov/galaxy/internal/controller"
|
||||
"github.com/iliadenisov/galaxy/internal/model/game"
|
||||
)
|
||||
|
||||
func MakeTurn(configure func(*controller.Param), race string, number int, name string) (err error) {
|
||||
control(configure, func(c *controller.Controller) {
|
||||
c.ExecuteGame(func(r controller.Repo, g *game.Game) { controller.MakeTurn(c, r) })
|
||||
func GenerateTurn(configure func(*controller.Param)) (err error) {
|
||||
err = control(configure, func(c *controller.Controller) error {
|
||||
return c.ExecuteState(func(r controller.Repo) error {
|
||||
g, err := r.LoadState()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.Cache = controller.NewCache(g)
|
||||
return controller.MakeTurn(c, r)
|
||||
})
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user