From 5cf7db2a867773abe127e956b8a5f03012647fdf Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 21 Jun 2011 02:24:22 +0200 Subject: Added massive amounts of debug messages git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@529 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/control/GameControl.java | 8 +++++++- src/jrummikub/control/network/NetworkRoundControl.java | 18 +++++++++++++----- src/jrummikub/control/network/NetworkTurnControl.java | 7 +++++-- 3 files changed, 25 insertions(+), 8 deletions(-) (limited to 'src') 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() { + @Override + public void handle(IRoundState newState) { + gameState = newState.getGameState(); + gameSettings = newState.getGameSettings(); + } + }); roundControl.getEndOfRoundEvent().add(new IListener1() { - @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() { @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()); -- cgit v1.2.3