diff --git a/game/commands.go b/game/commands.go index 4e7526e..6ff591f 100644 --- a/game/commands.go +++ b/game/commands.go @@ -32,7 +32,10 @@ func CommandLoop(w *pixelgl.Window, s State, stateCA chan<- State) { w.SetClosed(true) return case w.JustPressed(pixelgl.KeyEnter) || w.Pressed(pixelgl.KeySpace) || true: - s = UpdateState(s, sOld, <-cmdC) + for i, cmd := range <-cmdC { + s = doCommand(cmd, s, i) + } + s = UpdateState(s, sOld) turn++ if s.GameOver { s = NewState() diff --git a/game/game.go b/game/game.go index 4a341b9..0a8edac 100644 --- a/game/game.go +++ b/game/game.go @@ -42,11 +42,7 @@ type Baton struct { HolderID int } -func UpdateState(s State, sOld State, cmds []Command) State { - for i, cmd := range cmds { - s = doCommand(cmd, s, i) - } - +func UpdateState(s State, sOld State) State { var winners []int for _, t := range s.Teams { if r := ActiveRacer(t); r != nil {