Fix crash when moving checker backwards
This commit is contained in:
parent
3069f96568
commit
5df43b9539
1 changed files with 7 additions and 5 deletions
12
game.go
12
game.go
|
@ -425,12 +425,14 @@ ADDMOVES:
|
|||
}
|
||||
gameMove := gameCopy.Moves[i]
|
||||
if move[0] == gameMove[1] && move[1] == gameMove[0] {
|
||||
copy(gameCopy.Board, gameCopy.boardStates[i])
|
||||
gameCopy.Player1.Entered = gameCopy.enteredStates[i][0]
|
||||
gameCopy.Player2.Entered = gameCopy.enteredStates[i][1]
|
||||
gameCopy.boardStates = gameCopy.boardStates[:i]
|
||||
gameCopy.enteredStates = gameCopy.enteredStates[:i]
|
||||
gameCopy.Moves = gameCopy.Moves[:i]
|
||||
if !local {
|
||||
copy(gameCopy.Board, gameCopy.boardStates[i])
|
||||
gameCopy.Player1.Entered = gameCopy.enteredStates[i][0]
|
||||
gameCopy.Player2.Entered = gameCopy.enteredStates[i][1]
|
||||
gameCopy.boardStates = gameCopy.boardStates[:i]
|
||||
gameCopy.enteredStates = gameCopy.enteredStates[:i]
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue