summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/control/network')
-rw-r--r--src/jrummikub/control/network/NetworkRoundControl.java18
-rw-r--r--src/jrummikub/control/network/NetworkTurnControl.java7
2 files changed, 18 insertions, 7 deletions
diff --git a/src/jrummikub/control/network/NetworkRoundControl.java b/src/jrummikub/control/network/NetworkRoundControl.java
index d21e8e8..609376e 100644
--- a/src/jrummikub/control/network/NetworkRoundControl.java
+++ b/src/jrummikub/control/network/NetworkRoundControl.java
@@ -1,5 +1,7 @@
package jrummikub.control.network;
+import java.util.Date;
+
import jrummikub.control.RoundControl;
import jrummikub.control.turn.ITurnControl;
import jrummikub.model.IRoundState;
@@ -32,12 +34,14 @@ public class NetworkRoundControl extends RoundControl {
connections.add(connectionControl.getTurnStartEvent().add(new IListener() {
@Override
public void handle() {
+ System.err.println(new Date() + ": Received startTurn");
startTurn();
}
}));
connections.add(connectionControl.getNextPlayerEvent().add(new IListener() {
@Override
public void handle() {
+ System.err.println(new Date() + ": Received nextPlayer");
NetworkRoundControl.super.nextPlayer();
}
}));
@@ -64,6 +68,9 @@ public class NetworkRoundControl extends RoundControl {
break;
}
+ System.err.println("Creating a " + (currentlyActive ? "normal" : "network")
+ + " turn control for a " + type);
+
if (!currentlyActive) {
return new NetworkTurnControl(connectionControl);
}
@@ -73,13 +80,12 @@ public class NetworkRoundControl extends RoundControl {
@Override
protected void prepareTurn() {
- boolean wasActive = currentlyActive;
-
- doPrepareTurn();
-
- if (wasActive) {
+ if (currentlyActive) {
+ System.err.println(new Date() + ": Sending startTurn");
connectionControl.startTurn();
}
+
+ doPrepareTurn();
}
@Override
@@ -94,6 +100,7 @@ public class NetworkRoundControl extends RoundControl {
@Override
protected void nextPlayer() {
if (currentlyActive) {
+ System.err.println(new Date() + ": Sending nextPlayer");
connectionControl.nextPlayer();
}
}
@@ -101,6 +108,7 @@ public class NetworkRoundControl extends RoundControl {
@Override
protected void endOfTurn(InvalidTurnInfo invalidTurnInfo) {
if (currentlyActive) {
+ System.err.println(new Date() + ": Sending endTurn");
connectionControl.endTurn(roundState, invalidTurnInfo);
}
diff --git a/src/jrummikub/control/network/NetworkTurnControl.java b/src/jrummikub/control/network/NetworkTurnControl.java
index 7b0bcbb..5941a45 100644
--- a/src/jrummikub/control/network/NetworkTurnControl.java
+++ b/src/jrummikub/control/network/NetworkTurnControl.java
@@ -1,5 +1,7 @@
package jrummikub.control.network;
+import java.util.Date;
+
import jrummikub.control.RoundControl.InvalidTurnInfo;
import jrummikub.control.turn.AbstractTurnControl;
import jrummikub.model.IRoundState;
@@ -33,8 +35,9 @@ public class NetworkTurnControl extends AbstractTurnControl {
connections.add(connectionControl.getTurnEndEvent().add(
new IListener2<IRoundState, InvalidTurnInfo>() {
@Override
- public void handle(IRoundState state,
- InvalidTurnInfo invalidTurnInfo) {
+ public void handle(IRoundState state, InvalidTurnInfo invalidTurnInfo) {
+ System.err.println(new Date() + ": Received endTurn");
+
NetworkControl.fixGameSettings(state.getGameSettings(),
connectionControl.getNickname());