feat: turn stage increment after player's command

This commit is contained in:
Ilia Denisov
2026-02-08 16:35:58 +02:00
parent bf34843568
commit ba5d4e1ba8
14 changed files with 102 additions and 81 deletions
+10 -4
View File
@@ -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
}