Fix occasional crash on bot timeout during match
This commit is contained in:
parent
cc3f49319b
commit
1d2368295c
1 changed files with 4 additions and 1 deletions
|
@ -23,6 +23,7 @@ namespace ChessChallenge.Application
|
|||
}
|
||||
|
||||
// Game state
|
||||
Random rng;
|
||||
int gameID;
|
||||
bool isPlaying;
|
||||
Board board;
|
||||
|
@ -60,6 +61,7 @@ namespace ChessChallenge.Application
|
|||
tokenCount = GetTokenCount();
|
||||
Warmer.Warm();
|
||||
|
||||
rng = new Random();
|
||||
moveGenerator = new();
|
||||
boardUI = new BoardUI();
|
||||
board = new Board();
|
||||
|
@ -77,7 +79,7 @@ namespace ChessChallenge.Application
|
|||
{
|
||||
// End any ongoing game
|
||||
EndGame(GameResult.DrawByArbiter, log: false, autoStartNextBotMatch: false);
|
||||
gameID++;
|
||||
gameID = rng.Next();
|
||||
|
||||
// Stop prev task and create a new one
|
||||
if (RunBotsOnSeparateThread)
|
||||
|
@ -275,6 +277,7 @@ namespace ChessChallenge.Application
|
|||
{
|
||||
isPlaying = false;
|
||||
isWaitingToPlayMove = false;
|
||||
gameID = -1;
|
||||
|
||||
if (log)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue