diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-06-21 02:24:22 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-06-21 02:24:22 +0200 |
commit | 5cf7db2a867773abe127e956b8a5f03012647fdf (patch) | |
tree | 7b71b65d1774115c7f80bfbe42128d7117cae4f6 /src | |
parent | 2a31f0d9a6aa230ea499b09c49cdbccc7fc053b2 (diff) | |
download | JRummikub-5cf7db2a867773abe127e956b8a5f03012647fdf.tar JRummikub-5cf7db2a867773abe127e956b8a5f03012647fdf.zip |
Added massive amounts of debug messages
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@529 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src')
-rw-r--r-- | src/jrummikub/control/GameControl.java | 8 | ||||
-rw-r--r-- | src/jrummikub/control/network/NetworkRoundControl.java | 18 | ||||
-rw-r--r-- | src/jrummikub/control/network/NetworkTurnControl.java | 7 |
3 files changed, 25 insertions, 8 deletions
diff --git a/src/jrummikub/control/GameControl.java b/src/jrummikub/control/GameControl.java index ead4c51..c038f9a 100644 --- a/src/jrummikub/control/GameControl.java +++ b/src/jrummikub/control/GameControl.java @@ -156,8 +156,14 @@ public class GameControl { } roundControl = createRoundControl(roundState); + roundControl.getRoundStateUpdateEvent().add(new IListener1<IRoundState>() { + @Override + public void handle(IRoundState newState) { + gameState = newState.getGameState(); + gameSettings = newState.getGameSettings(); + } + }); roundControl.getEndOfRoundEvent().add(new IListener1<Score>() { - @Override public void handle(Score roundScore) { endOfRound(roundScore); 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()); |