summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-05-24 22:33:08 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-05-24 22:33:08 +0200
commit79bffeba5d42a5b228c52f69b9e0b4e88f2e60e8 (patch)
treef6f3859bea3d8b7526e5f1b8bc71166ad23d5490 /src
parent21f866d2ea8aa4514b52b7117de326956d3daad9 (diff)
downloadJRummikub-79bffeba5d42a5b228c52f69b9e0b4e88f2e60e8.tar
JRummikub-79bffeba5d42a5b228c52f69b9e0b4e88f2e60e8.zip
Fixed drawing single cards before the initial meld
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@269 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src')
-rw-r--r--src/jrummikub/control/RoundControl.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/jrummikub/control/RoundControl.java b/src/jrummikub/control/RoundControl.java
index d7a27bb..440e581 100644
--- a/src/jrummikub/control/RoundControl.java
+++ b/src/jrummikub/control/RoundControl.java
@@ -109,7 +109,7 @@ public class RoundControl {
}
}
- private boolean laidOutEnough() {
+ private boolean laidOutValidPoints() {
List<StoneSet> newSets = tableSetDifference(roundState.getTable(),
clonedTable);
@@ -118,13 +118,14 @@ public class RoundControl {
totalValue += set.classify().getSecond();
}
- return totalValue >= roundState.getGameSettings()
- .getInitialMeldThreshold();
+ return totalValue == 0
+ || totalValue >= roundState.getGameSettings()
+ .getInitialMeldThreshold();
}
private void endOfTurn() {
checkTurn();
-
+
if (roundState.getLastPlayer() == null) {
if (roundState.getGameHeap().getSize() == 0) {
roundState.setLastPlayer(roundState.getNthNextPlayer(-1));
@@ -143,26 +144,27 @@ public class RoundControl {
prepareTurn();
}
}
-
+
private void checkTurn() {
if (!clonedTable.isValid()) {
rejectMove();
return;
- }
+ }
if (!roundState.getActivePlayer().getLaidOut()) {
// Player touched forbidden stones
- if (!tableSetDifference(clonedTable, roundState.getTable()).isEmpty()) {
+ if (!tableSetDifference(clonedTable, roundState.getTable())
+ .isEmpty()) {
rejectMove();
return;
}
- if (!laidOutEnough()) {
+ if (!laidOutValidPoints()) {
rejectMove();
return;
}
}
Set<Stone> tableDiff = tableDifference(roundState.getTable(),
clonedTable);
-
+
roundState.setTable(clonedTable);
if (tableDiff.isEmpty()) {
@@ -182,7 +184,7 @@ public class RoundControl {
// deal penalty, reset
roundState.getGameHeap().putBack(tableDiff);
dealPenalty(tableDiff.size());
-
+
}
static Set<Stone> tableDifference(ITable oldTable, ITable newTable) {