summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control
diff options
context:
space:
mode:
authorIda Massow <massow@informatik.uni-luebeck.de>2011-05-30 19:08:33 +0200
committerIda Massow <massow@informatik.uni-luebeck.de>2011-05-30 19:08:33 +0200
commitae9ce59d36eed2b133977d37ab5e73a844ef334c (patch)
treea64d467c9e1852b6df663c72878285c02850ffa5 /src/jrummikub/control
parent498c2529bdd1b35406412a4b1c96f887871646f6 (diff)
downloadJRummikub-ae9ce59d36eed2b133977d37ab5e73a844ef334c.tar
JRummikub-ae9ce59d36eed2b133977d37ab5e73a844ef334c.zip
Warnings tauchen auf, wenn man beim Einstellen Unfug macht
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@325 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/control')
-rw-r--r--src/jrummikub/control/SettingsControl.java40
1 files changed, 37 insertions, 3 deletions
diff --git a/src/jrummikub/control/SettingsControl.java b/src/jrummikub/control/SettingsControl.java
index ffd1911..9cb216d 100644
--- a/src/jrummikub/control/SettingsControl.java
+++ b/src/jrummikub/control/SettingsControl.java
@@ -216,7 +216,7 @@ public class SettingsControl {
for (PlayerSettings player : settings.getPlayerList()) {
if (player.getName().isEmpty()) {
view.getSettingsPanel().setError(
- ISettingsPanel.SettingsError.NO_PLAYER_NAME);
+ ISettingsPanel.SettingsError.NO_PLAYER_NAME_ERROR);
view.getSettingsPanel().enableStartGameButton(false);
return false;
}
@@ -226,16 +226,50 @@ 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);
+ view.getSettingsPanel()
+ .setError(
+ ISettingsPanel.SettingsError.DUPLICATE_PLAYER_NAME_ERROR);
view.getSettingsPanel().enableStartGameButton(false);
return false;
}
}
}
+ int totalStonesDealt = settings.getNumberOfStonesDealt()
+ * settings.getPlayerList().size();
+ int totalStones = settings.getHighestCard() * settings.getStoneSetNumber()
+ * settings.getStoneColors().size() + settings.getJokerNumber();
+
+ if (totalStones <= totalStonesDealt) {
+ view.getSettingsPanel().setError(
+ ISettingsPanel.SettingsError.NOT_ENOUGH_STONES_ERROR);
+ view.getSettingsPanel().enableStartGameButton(false);
+ return false;
+ }
+
view.getSettingsPanel().setError(ISettingsPanel.SettingsError.NO_ERROR);
view.getSettingsPanel().enableStartGameButton(true);
+
+ if (settings.getInitialMeldThreshold() >= 100) {
+ view.getSettingsPanel().setError(
+ ISettingsPanel.SettingsError.TOO_HIGH_THRESHOLD_WARNING);
+ return true;
+ }
+
+ boolean humanPlayerFound = false;
+ for (PlayerSettings player : settings.getPlayerList()) {
+ if (player.getTurnControlType() == TurnControlFactory.Type.HUMAN) {
+ humanPlayerFound = true;
+ break;
+ }
+ }
+
+ if (!humanPlayerFound) {
+ view.getSettingsPanel().setError(
+ ISettingsPanel.SettingsError.COMPUTER_PLAYERS_ONLY_WARNING);
+ return true;
+ }
+
return true;
}