From ada3ba2775a12c2a9d997cf4e20168f42789cd37 Mon Sep 17 00:00:00 2001 From: lpan Date: Wed, 19 Feb 2020 14:59:46 -0800 Subject: [PATCH] retrived gameInfo from history --- src/view/LeducHoldemGameView.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/view/LeducHoldemGameView.js b/src/view/LeducHoldemGameView.js index c237d47..26a8f98 100644 --- a/src/view/LeducHoldemGameView.js +++ b/src/view/LeducHoldemGameView.js @@ -76,6 +76,11 @@ class LeducHoldemGameView extends React.Component { return gameInfo; } }else{ + // check if the game state of next turn is already in game state history + if(turn+1 < this.gameStateHistory[gameInfo.round].length){ + gameInfo = deepCopy(this.gameStateHistory[gameInfo.round][gameInfo.turn+1]); + return gameInfo; + } if(gameInfo.currentPlayer === this.moveHistory[gameInfo.round][gameInfo.turn].playerIdx){ gameInfo.latestAction[gameInfo.currentPlayer] = this.moveHistory[gameInfo.round][gameInfo.turn].move; switch (gameInfo.latestAction[gameInfo.currentPlayer]) {