summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/control')
-rw-r--r--src/jrummikub/control/SettingsControl.java39
1 files changed, 27 insertions, 12 deletions
diff --git a/src/jrummikub/control/SettingsControl.java b/src/jrummikub/control/SettingsControl.java
index 6f4e149..4351c59 100644
--- a/src/jrummikub/control/SettingsControl.java
+++ b/src/jrummikub/control/SettingsControl.java
@@ -34,9 +34,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 +44,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 +78,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 +104,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) {
@@ -138,6 +140,15 @@ public class SettingsControl {
update();
}
}));
+
+ connections.add(view.getSettingsPanel().getChangeNoLimitsEvent()
+ .add(new IListener1<Boolean>() {
+ @Override
+ public void handle(Boolean value) {
+ settings.setNoLimits(value);
+ update();
+ }
+ }));
}
private void addPlayerSettingsListeners() {
@@ -210,7 +221,8 @@ public class SettingsControl {
break;
}
- settings.getPlayerList().add(new PlayerSettings("Spieler " + num, color));
+ settings.getPlayerList().add(
+ new PlayerSettings("Spieler " + num, color));
update();
}
@@ -251,8 +263,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();
@@ -273,8 +286,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;
}
@@ -283,7 +297,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) {