diff --git a/corda/contracts/src/main/java/djmil/cordacheckers/states/GameState.java b/corda/contracts/src/main/java/djmil/cordacheckers/states/GameState.java index 76dd5d5..98f8537 100644 --- a/corda/contracts/src/main/java/djmil/cordacheckers/states/GameState.java +++ b/corda/contracts/src/main/java/djmil/cordacheckers/states/GameState.java @@ -68,11 +68,11 @@ public abstract class GameState implements ContractState { throw new NotInvolved(playerName, this.getClass(), gameUuid); } - public Stone.Color getOpponentColor(MemberX500Name playerName) throws NotInvolved { + public Stone.Color getPlayerColor(MemberX500Name playerName) throws NotInvolved { if (playerName.compareTo(whitePlayer) == 0) - return Stone.Color.BLACK; - if (playerName.compareTo(blackPlayer) == 0) return Stone.Color.WHITE; + if (playerName.compareTo(blackPlayer) == 0) + return Stone.Color.BLACK; throw new NotInvolved(playerName, this.getClass(), gameUuid); } diff --git a/corda/workflows/src/main/java/djmil/cordacheckers/gamestate/View.java b/corda/workflows/src/main/java/djmil/cordacheckers/gamestate/View.java index 9b1a965..41090c4 100644 --- a/corda/workflows/src/main/java/djmil/cordacheckers/gamestate/View.java +++ b/corda/workflows/src/main/java/djmil/cordacheckers/gamestate/View.java @@ -30,8 +30,8 @@ public class View { } public final Status status; + public final Stone.Color myColor; public final String opponentName; - public final Stone.Color opponentColor; public final Map board; public final Integer moveNumber; @@ -44,7 +44,7 @@ public class View { public View() { this.status = null; this.opponentName = null; - this.opponentColor = null; + this.myColor = null; this.board = null; this.moveNumber = null; this.previousMove = null; @@ -55,7 +55,7 @@ public class View { public View(View.Status status, MemberX500Name myName, GameProposalState gameProposal) { this.status = status; this.opponentName = gameProposal.getOpponentName(myName).getCommonName(); - this.opponentColor = gameProposal.getOpponentColor(myName); + this.myColor = gameProposal.getPlayerColor(myName); this.board = gameProposal.getBoard(); this.previousMove = null; this.moveNumber = 0; @@ -66,7 +66,7 @@ public class View { public View(View.Status status, MemberX500Name myName, GameBoardState gameBoard, List previousMove) { this.status = status; this.opponentName = gameBoard.getOpponentName(myName).getCommonName(); - this.opponentColor = gameBoard.getOpponentColor(myName); + this.myColor = gameBoard.getPlayerColor(myName); this.board = gameBoard.getBoard(); this.previousMove = previousMove; this.moveNumber = gameBoard.getMoveNumber(); @@ -77,7 +77,7 @@ public class View { public View(View.Status status, MemberX500Name myName, GameResultState gameResult) { this.status = status; this.opponentName = gameResult.getOpponentName(myName).getCommonName(); - this.opponentColor = gameResult.getOpponentColor(myName); + this.myColor = gameResult.getPlayerColor(myName); this.board = null; this.previousMove = null; this.moveNumber = gameResult.getTotalMoves();