Do not calculate legal moves locally when spectating

This commit is contained in:
Trevor Slocum 2024-11-23 20:22:40 -08:00
parent 9099608511
commit af879d0f03
2 changed files with 3 additions and 7 deletions

View file

@ -2278,7 +2278,7 @@ func (b *board) processState() {
b.updateOpponentLabel()
b.updatePlayerLabel()
if b.gameState.Turn != b.gameState.PlayerNumber {
if b.gameState.Spectating || b.gameState.Turn != b.gameState.PlayerNumber {
return
}

View file

@ -1922,12 +1922,8 @@ func (g *Game) handleEvent(e interface{}) {
roll := formatRoll(g.board.gameState.Roll1, g.board.gameState.Roll2, g.board.gameState.Roll3)
var extra string
if g.board.gameState.Turn != 0 {
tabulaBoard := tabulaBoard(g.board.gameState.Game, g.board.gameState.Game.Board)
available, _ := tabulaBoard.Available(g.board.gameState.Turn)
if len(available) > 0 {
extra = ":"
}
if g.board.gameState.Turn != 0 && len(g.board.gameState.Available) > 0 {
extra = ":"
}
name := g.board.gameState.Player1.Name