Merge pull request #35 from jhalitaksoy/fix/game-draw

fix game draw issue
This commit is contained in:
Halit Aksoy 2022-09-16 21:43:33 +03:00 committed by GitHub
commit 292ed803cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,9 +33,9 @@ function getInfoPanelTextByGameState(params: {
const isGameEnded = game?.mancalaGame.state == "ended";
if (isGameEnded) {
const wonPlayerID = game.mancalaGame.getWonPlayerId();
const wonPlayer = wonPlayerID == whitePlayer.id ? whitePlayer : blackPlayer;
let whoWon;
if (wonPlayer) {
if (wonPlayerID) {
const wonPlayer = wonPlayerID == whitePlayer.id ? whitePlayer : blackPlayer;
whoWon = isSpectator ? `${wonPlayer.name} ${context.texts.Won}` :
game.mancalaGame.getWonPlayerId() === currentUser.id
? context.texts.YouWon