diff options
Diffstat (limited to 'src/jrummikub/control')
-rw-r--r-- | src/jrummikub/control/RoundControl.java | 20 | ||||
-rw-r--r-- | src/jrummikub/control/network/NetworkRoundControl.java | 3 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/jrummikub/control/RoundControl.java b/src/jrummikub/control/RoundControl.java index 285980a..8dbf236 100644 --- a/src/jrummikub/control/RoundControl.java +++ b/src/jrummikub/control/RoundControl.java @@ -81,7 +81,10 @@ public class RoundControl { * Begin the round */ public void startRound() { - deal(); + if (roundState != null) { + deal(); + } + continueRound(); } @@ -103,7 +106,9 @@ public class RoundControl { } })); - prepareTurn(); + if (roundState != null) { + prepareTurn(); + } } /** @@ -117,11 +122,16 @@ public class RoundControl { } } + protected void setRoundState(IRoundState state) { + roundState = state; + roundStateUpdateEvent.emit(state); + } + protected void prepareTurn() { doPrepareTurn(); boolean isHuman = roundState.getActivePlayer().getPlayerSettings() - .getType() == HUMAN; + .getType() == HUMAN; boolean oneHuman = roundState.getGameSettings().oneHuman(); boolean isAI = (turnControl instanceof AIControl); @@ -157,6 +167,10 @@ public class RoundControl { } protected void startTurn() { + if (turnControl == null) { + doPrepareTurn(); + } + boolean isHuman = roundState.getActivePlayer().getPlayerSettings() .getType() == HUMAN; diff --git a/src/jrummikub/control/network/NetworkRoundControl.java b/src/jrummikub/control/network/NetworkRoundControl.java index a05f8ae..f500b18 100644 --- a/src/jrummikub/control/network/NetworkRoundControl.java +++ b/src/jrummikub/control/network/NetworkRoundControl.java @@ -23,7 +23,8 @@ public class NetworkRoundControl extends RoundControl { new IListener1<IRoundState>() { @Override public void handle(IRoundState state) { - NetworkRoundControl.this.roundState = state; + setRoundState(state); + startTurn(); } })); |