Fix transitioning spectators during rematch

This commit is contained in:
Trevor Slocum 2023-11-28 11:32:22 -08:00
parent 2d1454dc63
commit a06abe550f
2 changed files with 5 additions and 3 deletions

View file

@ -40,8 +40,8 @@ formatted responses are more easily parsed by computers.
- List all matches.
- Aliases: `ls`
- `create <public>/<private [password]> <points> [name]`
- Create a match.
- `create <public>/<private [password]> <points> <acey> [name]`
- Create a match. An `acey` value of 0 represents a standard game, while a value of 1 represents an acey-deucey game.
- Aliases: `c`
- `join <id>/<username> [password]`

View file

@ -1258,15 +1258,17 @@ COMMANDS:
newGame.password = clientGame.password
newGame.client1 = clientGame.client1
newGame.client2 = clientGame.client2
newGame.spectators = make([]*serverClient, len(clientGame.spectators))
copy(newGame.spectators, clientGame.spectators)
newGame.Player1 = clientGame.Player1
newGame.Player2 = clientGame.Player2
newGame.allowed1 = clientGame.allowed1
newGame.allowed2 = clientGame.allowed2
copy(newGame.spectators, clientGame.spectators)
s.games = append(s.games, newGame)
clientGame.client1 = nil
clientGame.client2 = nil
clientGame.spectators = nil
s.gamesLock.Unlock()