Fix dealing stones for more than 2 rows
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@244 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
57227570fe
commit
604ef91282
7 changed files with 89 additions and 48 deletions
|
@ -149,17 +149,26 @@ public class RoundControl {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void dealStone() {
|
||||
gameState
|
||||
.getActivePlayer()
|
||||
.getHand()
|
||||
.drop(gameState.getGameHeap().drawStone(),
|
||||
new Position(Hand.WIDTH - 1, Hand.HEIGHT - 1));
|
||||
void dealStones(int count) {
|
||||
IHand hand = gameState.getActivePlayer().getHand();
|
||||
int rowCount = hand.getRowCount();
|
||||
|
||||
for (int i = 0; i < count; ++i) {
|
||||
if (hand.getFreeRowSpace(rowCount - 1) == 0) {
|
||||
rowCount++;
|
||||
}
|
||||
|
||||
hand.drop(gameState.getGameHeap().drawStone(), new Position(
|
||||
Hand.WIDTH - 1, rowCount - 1));
|
||||
}
|
||||
}
|
||||
|
||||
private void dealStone() {
|
||||
dealStones(1);
|
||||
}
|
||||
|
||||
private void dealPenalty(int count) {
|
||||
for (int i = 0; i < count + 3; ++i)
|
||||
dealStone();
|
||||
dealStones(count + 3);
|
||||
}
|
||||
|
||||
private void win() {
|
||||
|
|
|
@ -247,11 +247,6 @@ public class TurnControl {
|
|||
if (x >= Hand.WIDTH) {
|
||||
x = 0;
|
||||
y++;
|
||||
|
||||
if (y >= Hand.HEIGHT) {
|
||||
// TODO We can't handle this yet...
|
||||
throw new ArrayIndexOutOfBoundsException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue