diff options
Diffstat (limited to 'src/jrummikub/control/GameControl.java')
-rw-r--r-- | src/jrummikub/control/GameControl.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/jrummikub/control/GameControl.java b/src/jrummikub/control/GameControl.java index 247e67a..fb3fcf8 100644 --- a/src/jrummikub/control/GameControl.java +++ b/src/jrummikub/control/GameControl.java @@ -20,6 +20,8 @@ import jrummikub.view.IView.BottomPanelType; * Controls a Game, at some point including all Rounds, starts new Rounds */ public class GameControl { + private SaveControl saveControl; + private GameSettings gameSettings; private IView view; RoundControl roundControl; @@ -31,15 +33,21 @@ public class GameControl { * Constructor * * @param gameSettings - * the game settings + * the game settings + * @param saveControl + * the save control * @param view - * the view + * the view */ - public GameControl(GameSettings gameSettings, IView view) { + public GameControl(GameSettings gameSettings, SaveControl saveControl, + IView view) { this.gameSettings = gameSettings; + this.saveControl = saveControl; this.view = view; gameState = new GameState(); + saveControl.setGameState(gameState); + gameState.setFirstRoundFirstPlayer((int) (Math.random() * gameSettings .getPlayerList().size())); @@ -96,6 +104,7 @@ public class GameControl { view.showScorePanel(false); IRoundState roundState = new RoundState(gameSettings); + saveControl.setRoundState(roundState); roundState.setActivePlayerNumber(gameState.getFirstRoundFirstPlayer() + gameState.getScores().size()); @@ -133,8 +142,7 @@ public class GameControl { view.getScorePanel().setPlayers(gameSettings.getPlayerList()); view.getScorePanel().setScores(gameState.getScores()); - view.getScorePanel().setAccumulatedScore( - gameState.getAccumulatedScore()); + view.getScorePanel().setAccumulatedScore(gameState.getAccumulatedScore()); view.getScorePanel().update(); view.showScorePanel(true); } |