summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/control')
-rw-r--r--src/jrummikub/control/GameControl.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/jrummikub/control/GameControl.java b/src/jrummikub/control/GameControl.java
index 1d93c63..ac47e2f 100644
--- a/src/jrummikub/control/GameControl.java
+++ b/src/jrummikub/control/GameControl.java
@@ -1,6 +1,7 @@
package jrummikub.control;
import jrummikub.model.GameSettings;
+import jrummikub.model.GameState;
import jrummikub.model.IRoundState;
import jrummikub.model.RoundState;
import jrummikub.util.IListener;
@@ -13,6 +14,7 @@ public class GameControl {
private GameSettings gameSettings;
private IView view;
private RoundControl roundControl;
+ private GameState gameState;
/**
* Constructor
@@ -25,6 +27,9 @@ public class GameControl {
public GameControl(GameSettings gameSettings, IView view) {
this.gameSettings = gameSettings;
this.view = view;
+
+ gameState = new GameState();
+ gameState.setFirstRoundFirstPlayer((int)(Math.random() * gameSettings.getPlayerList().size()));
view.getNewGameEvent().add(new IListener() {
@Override
@@ -54,6 +59,9 @@ public class GameControl {
IRoundState roundState = new RoundState(gameSettings);
+ // TODO: add number of already played rounds
+ roundState.setActivePlayerNumber(gameState.getFirstRoundFirstPlayer());
+
roundControl = new RoundControl(roundState, view);
roundControl.getEndRoundEvent().add(new IListener() {