summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control/RoundControl.java
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-05-27 17:54:46 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-05-27 17:54:46 +0200
commit2d198820a9634c30d62c77f6f310aa227ee29733 (patch)
tree5096eaf907f64343b9997abea3f51ee4c070cb00 /src/jrummikub/control/RoundControl.java
parent63397e2f5fc62c7d1fc2efbe8f4c686b2343e471 (diff)
downloadJRummikub-2d198820a9634c30d62c77f6f310aa227ee29733.tar
JRummikub-2d198820a9634c30d62c77f6f310aa227ee29733.zip
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
Diffstat (limited to 'src/jrummikub/control/RoundControl.java')
-rw-r--r--src/jrummikub/control/RoundControl.java22
1 files changed, 12 insertions, 10 deletions
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<Connection>(connections)) {
c.remove();
}
restartRoundEvent.emit();