diff --git a/server/src/game/nextRound.go b/server/src/game/nextRound.go index e2cead4..a0997c1 100644 --- a/server/src/game/nextRound.go +++ b/server/src/game/nextRound.go @@ -21,7 +21,16 @@ func (gm *Game) nextRound() { } gm.notifyClients() - time.Sleep(2 * time.Second) + time.Sleep(1500 * time.Millisecond) + + err = gm.changeGameState(STATE_READY_SET, STATE_READY_SET, "") + if err != nil { + fmt.Println(err) + return + } + gm.notifyClients() + + time.Sleep(1500 * time.Millisecond) err = gm.changeGameState(STATE_READY_SET, STATE_PLAY, PHASE_NONE) if err != nil { diff --git a/server/src/game/setupRound.go b/server/src/game/setupRound.go index eccf5a4..bb10e4e 100644 --- a/server/src/game/setupRound.go +++ b/server/src/game/setupRound.go @@ -36,18 +36,24 @@ func (gm *Game) selectQuote() { } sourceId := q.GetSourceId() - if !gm.isSourceIdInList(sources, sourceId) { - sources = append(sources, gm.getSourceById(sourceId)) - } if len(sources) == 12 { - break + if quote != nil { + break + } + } else { + if !gm.isSourceIdInList(sources, sourceId) { + sources = append(sources, gm.getSourceById(sourceId)) + } } } gm.mu.Lock() defer gm.mu.Unlock() gm.round.quoteId = quote.GetId() - gm.round.sources = sources + gm.round.sources = make([]Source, len(sources)) + for idx, idxPerm := range r.Perm(len(sources)) { + gm.round.sources[idx] = sources[idxPerm] + } } func (gm *Game) getSourceById(id string) Source {