Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mytja committed Jan 21, 2024
1 parent 77478bc commit 3382bc3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 13 additions & 1 deletion backend/internal/tournament/goroutine.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,19 @@ func (s *tournamentImpl) RunOrganizer() {

s.logger.Debugw("odpiram talon")

for i := range s.games {
for i, g := range s.games {
start := true
for _, v := range g.Players {
if !v.GetBotStatus() && len(v.GetClients()) == 0 {
s.logger.Debugw("preskakujem igro")
start = false
break
}
}
if !start {
// drugače crasha
continue
}
s.wsServer.Talon(i)
}

Expand Down
4 changes: 4 additions & 0 deletions backend/internal/ws/cards.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ func (s *serverImpl) BotCard(gameId string, playing string) {

sT := time.Now()
card := strings.ReplaceAll(string(s.StockSkisExec("card", playing, gameId)), "\n", "")
if card == "" {
s.logger.Debugw("stockškis failed")
return
}
eT := time.Now()

player.BroadcastToClients(&messages.Message{
Expand Down

0 comments on commit 3382bc3

Please sign in to comment.