knowyt/server/src/game/runRound.go

27 lines
494 B
Go

package game
import (
"fmt"
)
func (gm *Game) runRound() {
state, _ := gm.GetState()
if state != STATE_IDLE && state != STATE_PLAY && state != STATE_COLLECT {
fmt.Printf("%s expected state \"IDLE\" | \"PLAY\" | \"COLLECT\" != \"%s\"", gm.GetId(), state)
return
}
err := gm.changeGameState(STATE_ANY, STATE_PLAY, PHASE_SELECT_QUOTE)
if err != nil {
fmt.Println(err)
return
}
errRound := gm.setupRound()
if errRound != nil {
gm.runFinal()
return
}
gm.notifyClients()
}