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
This commit is contained in:
Matthias Schiffer 2011-05-18 17:01:11 +02:00
parent b5397d5aa7
commit e76977652d
5 changed files with 54 additions and 22 deletions

View file

@ -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;
/**
@ -13,10 +18,20 @@ public class GameSettings {
initialMeldThreshold = 30;
}
/**
* 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;

View file

@ -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();
}