summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/model
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-18 17:01:11 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-18 17:01:11 +0200
commite76977652d55463b98f847ce261926f0d9d7c0de (patch)
tree44798d441592c22a694da990fdf5d9333946562a /src/jrummikub/model
parentb5397d5aa7f01d557a469ca0d70f3b33e1fe2c60 (diff)
downloadJRummikub-e76977652d55463b98f847ce261926f0d9d7c0de.tar
JRummikub-e76977652d55463b98f847ce261926f0d9d7c0de.zip
RoundControl: Create players from player settings list from game settings
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@253 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/model')
-rw-r--r--src/jrummikub/model/GameSettings.java17
-rw-r--r--src/jrummikub/model/RoundState.java10
2 files changed, 21 insertions, 6 deletions
diff --git a/src/jrummikub/model/GameSettings.java b/src/jrummikub/model/GameSettings.java
index b7177ef..b5079d4 100644
--- a/src/jrummikub/model/GameSettings.java
+++ b/src/jrummikub/model/GameSettings.java
@@ -1,9 +1,14 @@
package jrummikub.model;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* The overall game settings
*/
public class GameSettings {
+ private List<PlayerSettings> players = new ArrayList<PlayerSettings>();
+
private int initialMeldThreshold;
/**
@@ -14,9 +19,19 @@ public class GameSettings {
}
/**
+ * Returns the list containing the settings of all players
+ *
+ * @return the player settings list
+ */
+ public List<PlayerSettings> getPlayerList() {
+ return players;
+ }
+
+ /**
* Sets the initial meld threshold
*
- * @param value the value to set
+ * @param value
+ * the value to set
*/
public void setInitialMeldThreshold(int value) {
initialMeldThreshold = value;
diff --git a/src/jrummikub/model/RoundState.java b/src/jrummikub/model/RoundState.java
index b566fdf..56f7904 100644
--- a/src/jrummikub/model/RoundState.java
+++ b/src/jrummikub/model/RoundState.java
@@ -1,6 +1,5 @@
package jrummikub.model;
-import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
@@ -24,10 +23,11 @@ public class RoundState implements IRoundState {
table = new Table();
players = new ArrayList<Player>();
- players.add(new Player(new PlayerSettings("Ida", Color.RED)));
- players.add(new Player(new PlayerSettings("Matthias", Color.YELLOW)));
- players.add(new Player(new PlayerSettings("Jannis", Color.GREEN)));
- players.add(new Player(new PlayerSettings("Bennet", Color.BLACK)));
+
+ for (PlayerSettings playerSettings : gameSettings.getPlayerList()) {
+ players.add(new Player(playerSettings));
+ }
+
activePlayer = 0;
gameHeap = new StoneHeap();
}