pull doCommand call out of UpdateState
This commit is contained in:
parent
6eb0e55dcc
commit
6a9943993c
|
@ -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()
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue