summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/model')
-rw-r--r--src/jrummikub/model/IRoundState.java14
-rw-r--r--src/jrummikub/model/RoundState.java13
2 files changed, 27 insertions, 0 deletions
diff --git a/src/jrummikub/model/IRoundState.java b/src/jrummikub/model/IRoundState.java
index faed6cf..1f6da15 100644
--- a/src/jrummikub/model/IRoundState.java
+++ b/src/jrummikub/model/IRoundState.java
@@ -94,4 +94,18 @@ public interface IRoundState {
*/
public void setActivePlayerNumber(int i);
+ /**
+ * Gets the number of the current turn. Numbers smaller than one indicate
+ * hand inspection turns
+ *
+ * @return current turn number
+ */
+ public abstract int getTurnNumber();
+
+ /**
+ * Increments the turn number
+ *
+ */
+ public void nextTurn();
+
} \ No newline at end of file
diff --git a/src/jrummikub/model/RoundState.java b/src/jrummikub/model/RoundState.java
index eb87247..65bc120 100644
--- a/src/jrummikub/model/RoundState.java
+++ b/src/jrummikub/model/RoundState.java
@@ -12,6 +12,7 @@ public class RoundState implements IRoundState {
private int activePlayer;
private StoneHeap gameHeap;
private IPlayer lastPlayer;
+ private int turnNumber;
/**
* Create a new RoundState with an empty table
@@ -29,6 +30,8 @@ public class RoundState implements IRoundState {
players.add(new Player(playerSettings, gameSettings));
}
+ turnNumber = 1-gameSettings.getPlayerList().size();
+
activePlayer = 0;
gameHeap = new StoneHeap();
}
@@ -104,4 +107,14 @@ public class RoundState implements IRoundState {
public IPlayer getLastPlayer() {
return lastPlayer;
}
+
+ @Override
+ public int getTurnNumber() {
+ return turnNumber;
+ }
+
+ @Override
+ public void nextTurn() {
+ turnNumber++;
+ }
}