summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/luxons/sevenwonders/game/Settings.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/luxons/sevenwonders/game/Settings.java b/src/main/java/org/luxons/sevenwonders/game/Settings.java
index 30e779df..b70caa71 100644
--- a/src/main/java/org/luxons/sevenwonders/game/Settings.java
+++ b/src/main/java/org/luxons/sevenwonders/game/Settings.java
@@ -6,7 +6,7 @@ import org.luxons.sevenwonders.game.wonders.WonderSide;
public class Settings {
- private int nbPlayers = 4;
+ private int nbPlayers = -1;
private int initialGold = 3;
@@ -14,11 +14,15 @@ public class Settings {
private WonderSide wonderSide = WonderSide.A;
+ // will default to nbPlayers + 2
private Integer nbGuildCards = null;
private long randomSeedForTests = 0;
public int getNbPlayers() {
+ if (nbPlayers < 0) {
+ throw new IllegalStateException("The number of players has not been initialized");
+ }
return nbPlayers;
}
@@ -51,7 +55,7 @@ public class Settings {
}
public int getNbGuildCards() {
- return nbGuildCards == null ? nbPlayers + 2 : nbGuildCards;
+ return nbGuildCards == null ? getNbPlayers() + 2 : nbGuildCards;
}
public void setNbGuildCards(int nbGuildCards) {
bgstack15