summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control
diff options
context:
space:
mode:
authorIda Massow <massow@informatik.uni-luebeck.de>2011-06-13 18:22:55 +0200
committerIda Massow <massow@informatik.uni-luebeck.de>2011-06-13 18:22:55 +0200
commit70d6ae6d749d11ced007fa781ce65c6e27229007 (patch)
tree67beb90aeafcc48130188cf54dfc8b8847b62db0 /src/jrummikub/control
parenta4faa8db23589930a828250816ebaeddf787c689 (diff)
downloadJRummikub-70d6ae6d749d11ced007fa781ce65c6e27229007.tar
JRummikub-70d6ae6d749d11ced007fa781ce65c6e27229007.zip
Player Type in player settings verschoben
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@420 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/control')
-rw-r--r--src/jrummikub/control/RoundControl.java2
-rw-r--r--src/jrummikub/control/SettingsControl.java39
-rw-r--r--src/jrummikub/control/turn/TurnControlFactory.java14
3 files changed, 26 insertions, 29 deletions
diff --git a/src/jrummikub/control/RoundControl.java b/src/jrummikub/control/RoundControl.java
index 281b367..a420b6d 100644
--- a/src/jrummikub/control/RoundControl.java
+++ b/src/jrummikub/control/RoundControl.java
@@ -1,6 +1,6 @@
package jrummikub.control;
-import static jrummikub.control.turn.TurnControlFactory.Type.*;
+import static jrummikub.model.PlayerSettings.Type.*;
import java.util.ArrayList;
import java.util.HashSet;
diff --git a/src/jrummikub/control/SettingsControl.java b/src/jrummikub/control/SettingsControl.java
index ad88b70..0da2f19 100644
--- a/src/jrummikub/control/SettingsControl.java
+++ b/src/jrummikub/control/SettingsControl.java
@@ -6,10 +6,9 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import jrummikub.control.turn.TurnControlFactory;
-import jrummikub.control.turn.TurnControlFactory.Type;
import jrummikub.model.GameSettings;
import jrummikub.model.PlayerSettings;
+import jrummikub.model.PlayerSettings.Type;
import jrummikub.model.StoneColor;
import jrummikub.util.Connection;
import jrummikub.util.Event1;
@@ -34,9 +33,9 @@ public class SettingsControl {
* Create a new settings control
*
* @param view
- * the view to use
+ * the view to use
* @param settings
- * initial game settings
+ * initial game settings
*/
public SettingsControl(IView view, GameSettings settings) {
this.view = view;
@@ -44,8 +43,8 @@ public class SettingsControl {
}
/**
- * the start game event is emitted when the user wants to start a game and the
- * settings made are valid
+ * the start game event is emitted when the user wants to start a game and
+ * the settings made are valid
*
* @return the event
*/
@@ -78,7 +77,8 @@ public class SettingsControl {
private void addOptionListeners1() {
connections.add(view.getSettingsPanel()
- .getChangeInitialMeldThresholdEvent().add(new IListener1<Integer>() {
+ .getChangeInitialMeldThresholdEvent()
+ .add(new IListener1<Integer>() {
@Override
public void handle(Integer value) {
settings.setInitialMeldThreshold(value);
@@ -103,7 +103,8 @@ public class SettingsControl {
update();
}
}));
- connections.add(view.getSettingsPanel().getChangeNumberOfStonesDealtEvent()
+ connections.add(view.getSettingsPanel()
+ .getChangeNumberOfStonesDealtEvent()
.add(new IListener1<Integer>() {
@Override
public void handle(Integer value) {
@@ -206,9 +207,9 @@ public class SettingsControl {
}
}));
connections.add(view.getSettingsPanel().getChangePlayerTypeEvent()
- .add(new IListener2<Integer, TurnControlFactory.Type>() {
+ .add(new IListener2<Integer, Type>() {
@Override
- public void handle(Integer i, TurnControlFactory.Type type) {
+ public void handle(Integer i, Type type) {
setPlayerType(i, type);
}
}));
@@ -246,7 +247,8 @@ public class SettingsControl {
break;
}
- settings.getPlayerList().add(new PlayerSettings("Spieler " + num, color));
+ settings.getPlayerList().add(
+ new PlayerSettings("Spieler " + num, color));
update();
}
@@ -287,8 +289,9 @@ public class SettingsControl {
protected void update() {
view.getSettingsPanel().enableRemovePlayerButtons(
settings.getPlayerList().size() > 2);
- view.getSettingsPanel().enableAddPlayerButton(
- settings.getPlayerList().size() < ISettingsPanel.PLAYER_COLORS.length);
+ view.getSettingsPanel()
+ .enableAddPlayerButton(
+ settings.getPlayerList().size() < ISettingsPanel.PLAYER_COLORS.length);
checkSettings();
@@ -322,8 +325,9 @@ public class SettingsControl {
for (int j = i + 1; j < settings.getPlayerList().size(); ++j) {
if (settings.getPlayerList().get(j).getName().equals(name)) {
- view.getSettingsPanel().setError(
- ISettingsPanel.SettingsError.DUPLICATE_PLAYER_NAME_ERROR);
+ view.getSettingsPanel()
+ .setError(
+ ISettingsPanel.SettingsError.DUPLICATE_PLAYER_NAME_ERROR);
view.getSettingsPanel().enableStartGameButton(false);
return false;
}
@@ -332,7 +336,8 @@ public class SettingsControl {
int totalStonesDealt = settings.getNumberOfStonesDealt()
* settings.getPlayerList().size();
- int totalStones = settings.getHighestValue() * settings.getStoneSetNumber()
+ int totalStones = settings.getHighestValue()
+ * settings.getStoneSetNumber()
* settings.getStoneColors().size() + settings.getJokerNumber();
if (totalStones <= totalStonesDealt) {
@@ -361,7 +366,7 @@ public class SettingsControl {
boolean humanPlayerFound = false;
for (PlayerSettings player : settings.getPlayerList()) {
- if (player.getTurnControlType() == TurnControlFactory.Type.HUMAN) {
+ if (player.getTurnControlType() == Type.HUMAN) {
humanPlayerFound = true;
break;
}
diff --git a/src/jrummikub/control/turn/TurnControlFactory.java b/src/jrummikub/control/turn/TurnControlFactory.java
index b42f7ff..4d143e7 100644
--- a/src/jrummikub/control/turn/TurnControlFactory.java
+++ b/src/jrummikub/control/turn/TurnControlFactory.java
@@ -1,5 +1,7 @@
package jrummikub.control.turn;
+import jrummikub.model.PlayerSettings;
+
/**
* Creates a turn control for the active player, regarding if layer is human or
* computer
@@ -7,16 +9,6 @@ package jrummikub.control.turn;
*/
public abstract class TurnControlFactory {
/**
- * Type of turn control.
- */
- public enum Type {
- /** */
- HUMAN,
- /** */
- COMPUTER
- };
-
- /**
* Creates a new turn control instance
*
* @return the turn control
@@ -30,7 +22,7 @@ public abstract class TurnControlFactory {
* Human or Computer
* @return TurnControlFactory for the player kind
*/
- static public TurnControlFactory getFactory(Type type) {
+ static public TurnControlFactory getFactory(PlayerSettings.Type type) {
switch (type) {
case HUMAN:
return HumanTurnControl.getFactory();