From a07e723242da4fbdd00cee2d86a46f4db70bc87a Mon Sep 17 00:00:00 2001 From: Ida Massow Date: Fri, 17 Jun 2011 20:00:45 +0200 Subject: =?UTF-8?q?StartTurn=20panel=20f=C3=BCr=20einen=20menschlichen=20s?= =?UTF-8?q?pieler=20angepasst?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@447 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/control/RoundControl.java | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src/jrummikub/control/RoundControl.java') 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 updateBestScore( Pair bestScore, int stonePoints, int size) { if (bestScore.getFirst() == stonePoints) { - return new Pair(stonePoints, Math.min( - bestScore.getSecond(), size)); + return new Pair(stonePoints, Math.min(bestScore + .getSecond(), size)); } else if (bestScore.getFirst() < stonePoints) { return new Pair(stonePoints, size); } -- cgit v1.2.3