From 2d198820a9634c30d62c77f6f310aa227ee29733 Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Fri, 27 May 2011 17:54:46 +0200 Subject: GameControl tests, temporary handler in SettingsControl and small fixes git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@288 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/control/RoundControl.java | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/jrummikub/control/RoundControl.java') diff --git a/src/jrummikub/control/RoundControl.java b/src/jrummikub/control/RoundControl.java index e9e9453..8aed1ce 100644 --- a/src/jrummikub/control/RoundControl.java +++ b/src/jrummikub/control/RoundControl.java @@ -27,7 +27,7 @@ import jrummikub.view.IView; * Controller that manages a single round of rummikub */ public class RoundControl { - private IRoundState roundState; + IRoundState roundState; private IView view; private ITable clonedTable; private Event restartRoundEvent = new Event(); @@ -70,12 +70,7 @@ public class RoundControl { } })); - connections.add(view.getPlayerPanel().getRedealEvent().add(new IListener() { - @Override - public void handle() { - redeal(); - } - })); + prepareTurn(); } @@ -91,13 +86,20 @@ public class RoundControl { private void startTurn() { TurnControl turnControl = new TurnControl(roundState.getActivePlayer() .getHand(), clonedTable, view, roundState.getTurnNumber() < 1); - connections.add(turnControl.getEndOfTurnEvent().add(new IListener() { + turnControl.getEndOfTurnEvent().add(new IListener() { @Override public void handle() { endOfTurn(); } - })); + }); + + turnControl.getRedealEvent().add(new IListener() { + @Override + public void handle() { + redeal(); + } + }); turnControl.startTurn(); } @@ -322,7 +324,7 @@ public class RoundControl { } private void redeal() { - for (Connection c : connections) { + for (Connection c : new ArrayList(connections)) { c.remove(); } restartRoundEvent.emit(); -- cgit v1.2.3