diff options
Diffstat (limited to 'src/jrummikub')
-rw-r--r-- | src/jrummikub/control/RoundControl.java | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/jrummikub/control/RoundControl.java b/src/jrummikub/control/RoundControl.java index 89baeb2..84ae8c6 100644 --- a/src/jrummikub/control/RoundControl.java +++ b/src/jrummikub/control/RoundControl.java @@ -101,11 +101,22 @@ public class RoundControl { private void prepareTurn() { boolean isHuman = roundState.getActivePlayer().getPlayerSettings() .getType() == HUMAN; + boolean oneHuman = roundState.getGameSettings().oneHuman(); + clonedTable = (ITable) roundState.getTable().clone(); clonedHand = (IHand) roundState.getActivePlayer().getHand().clone(); - view.setBottomPanel(isHuman ? BottomPanelType.START_TURN_PANEL - : BottomPanelType.COMPUTER_HAND_PANEL); + if (!oneHuman) { + view.setBottomPanel(isHuman ? BottomPanelType.START_TURN_PANEL + : BottomPanelType.COMPUTER_HAND_PANEL); + } else { + if (!isHuman) { + view.setBottomPanel(BottomPanelType.COMPUTER_HAND_PANEL); + } else { + view.setBottomPanel(BottomPanelType.HUMAN_HAND_PANEL); + startTurn(); + } + } view.getTablePanel().setStoneSets(clonedTable.clone()); view.setCurrentPlayerName(roundState.getActivePlayer() @@ -138,8 +149,8 @@ public class RoundControl { view.getPlayerPanel().setEndTurnMode(turnMode); } turnControl = TurnControlFactory.getFactory( - roundState.getActivePlayer().getPlayerSettings() - .getType()).create(); + roundState.getActivePlayer().getPlayerSettings().getType()) + .create(); turnControl.setup(new ITurnControl.TurnInfo(clonedTable, clonedHand, roundState.getActivePlayer().getLaidOut(), turnMode), roundState.getGameSettings(), view); @@ -348,8 +359,8 @@ public class RoundControl { .getGameSettings()); } - bestScore = updateBestScore(bestScore, -stonePoints, - playerHand.getSize()); + bestScore = updateBestScore(bestScore, -stonePoints, playerHand + .getSize()); points.add(-stonePoints); pointSum += stonePoints; @@ -371,8 +382,8 @@ public class RoundControl { private static Pair<Integer, Integer> updateBestScore( Pair<Integer, Integer> bestScore, int stonePoints, int size) { if (bestScore.getFirst() == stonePoints) { - return new Pair<Integer, Integer>(stonePoints, Math.min( - bestScore.getSecond(), size)); + return new Pair<Integer, Integer>(stonePoints, Math.min(bestScore + .getSecond(), size)); } else if (bestScore.getFirst() < stonePoints) { return new Pair<Integer, Integer>(stonePoints, size); } |