diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2016-12-14 21:14:46 +0100 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2016-12-14 21:14:46 +0100 |
commit | 8823b3172620cdf1f6f8d476adb0972f46ed06be (patch) | |
tree | 60f02fc42625c50169c7ee87f383aa9dcfc47e6d /src/main/java/org | |
parent | Update frontend POC with new lobby system (diff) | |
download | seven-wonders-8823b3172620cdf1f6f8d476adb0972f46ed06be.tar.gz seven-wonders-8823b3172620cdf1f6f8d476adb0972f46ed06be.tar.bz2 seven-wonders-8823b3172620cdf1f6f8d476adb0972f46ed06be.zip |
Fix default nbPlayers in the settings
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/luxons/sevenwonders/game/Settings.java | 8 |
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) { |