summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control/RoundControl.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/control/RoundControl.java')
-rw-r--r--src/jrummikub/control/RoundControl.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/jrummikub/control/RoundControl.java b/src/jrummikub/control/RoundControl.java
index 4819aad..5e85167 100644
--- a/src/jrummikub/control/RoundControl.java
+++ b/src/jrummikub/control/RoundControl.java
@@ -36,6 +36,7 @@ public class RoundControl {
IRoundState roundState;
private IView view;
private ITable clonedTable;
+ IHand clonedHand;
private Event restartRoundEvent = new Event();
private Event1<Score> endOfRoundEvent = new Event1<Score>();
private List<Connection> connections = new ArrayList<Connection>();
@@ -84,6 +85,7 @@ public class RoundControl {
boolean isHuman = roundState.getActivePlayer().getPlayerSettings()
.getTurnControlType() == HUMAN;
clonedTable = (ITable) roundState.getTable().clone();
+ clonedHand = (IHand) roundState.getActivePlayer().getHand().clone();
view.setBottomPanel(isHuman ? BottomPanelType.START_TURN_PANEL
: BottomPanelType.COMPUTER_HAND_PANEL);
@@ -109,7 +111,7 @@ public class RoundControl {
if (roundState.getTurnNumber() < 1) {
turnMode = TurnMode.INSPECT_ONLY;
- if (roundState.getActivePlayer().getHand().getIdenticalStoneCount() >= 3) {
+ if (clonedHand.getIdenticalStoneCount() >= 3) {
turnMode = TurnMode.MAY_REDEAL;
}
}
@@ -120,8 +122,9 @@ public class RoundControl {
turnControl = TurnControlFactory.getFactory(
roundState.getActivePlayer().getPlayerSettings().getTurnControlType())
.create();
- turnControl.setup(roundState.getGameSettings(),
- roundState.getActivePlayer(), clonedTable, view, turnMode);
+ turnControl.setup(new ITurnControl.TurnInfo(clonedTable, clonedHand,
+ roundState.getActivePlayer().getLaidOut(), turnMode), roundState
+ .getGameSettings(), view);
turnControl.getEndOfTurnEvent().add(new IListener() {
@Override
public void handle() {
@@ -189,6 +192,8 @@ public class RoundControl {
}
private void checkTurn() {
+ roundState.getActivePlayer().setHand(clonedHand);
+
if (!clonedTable.isValid()) {
rejectMove();
return;