summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-06-20 00:40:55 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-06-20 00:40:55 +0200
commitfcf33eb280d64b0ce376f7fa10d508c153b2ada9 (patch)
tree54b0fd8968bf92e9fd602929234d83dd67f5fa2e /src
parentec54bde90aad27a5ec4bc7bfec6cef732c7c3348 (diff)
downloadJRummikub-fcf33eb280d64b0ce376f7fa10d508c153b2ada9.tar
JRummikub-fcf33eb280d64b0ce376f7fa10d508c153b2ada9.zip
Add client side to NetworkRoundControl test and implementation
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@498 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src')
-rw-r--r--src/jrummikub/control/RoundControl.java20
-rw-r--r--src/jrummikub/control/network/NetworkRoundControl.java3
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();
}
}));