saving new turn
This commit is contained in:
+3
-3
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
type Repo interface {
|
||||
Persist(game.Game) error
|
||||
SaveTurn(uint, game.Game) error
|
||||
}
|
||||
|
||||
func NewGame(r Repo, races []string) (uuid.UUID, error) {
|
||||
@@ -46,7 +46,7 @@ func NewGame(r Repo, races []string) (uuid.UUID, error) {
|
||||
g.Race[i] = game.Race{
|
||||
ID: raceID,
|
||||
Name: races[i],
|
||||
Ally: raceID,
|
||||
Vote: raceID,
|
||||
Drive: 1,
|
||||
Weapons: 1,
|
||||
Shields: 1,
|
||||
@@ -104,7 +104,7 @@ func NewGame(r Repo, races []string) (uuid.UUID, error) {
|
||||
|
||||
g.Map = *gameMap
|
||||
|
||||
if err := r.Persist(*g); err != nil {
|
||||
if err := r.SaveTurn(0, *g); err != nil {
|
||||
return uuid.Nil, fmt.Errorf("persist: %s", err)
|
||||
}
|
||||
return g.ID, nil
|
||||
|
||||
Reference in New Issue
Block a user