summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIda Massow <massow@informatik.uni-luebeck.de>2011-06-17 20:00:45 +0200
committerIda Massow <massow@informatik.uni-luebeck.de>2011-06-17 20:00:45 +0200
commita07e723242da4fbdd00cee2d86a46f4db70bc87a (patch)
tree6943852b009b91310f9a7e0934343578b8b5fe2e /src
parent4f71c5cb4700b39d816c6a4ae123ad94fef456df (diff)
downloadJRummikub-a07e723242da4fbdd00cee2d86a46f4db70bc87a.tar
JRummikub-a07e723242da4fbdd00cee2d86a46f4db70bc87a.zip
StartTurn panel für einen menschlichen spieler angepasst
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@447 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src')
-rw-r--r--src/jrummikub/control/RoundControl.java27
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);
}