summaryrefslogtreecommitdiffstats
path: root/src/jrummikub
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-10 00:34:43 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-10 00:34:43 +0200
commit8a3439f7369e4059cb49f65413028b57f8fc7daa (patch)
tree570dcaeabef172a3cb6293d5a6681e324050cb9a /src/jrummikub
parent3338af2d439019fedced4be5b105ce06129a3712 (diff)
downloadJRummikub-8a3439f7369e4059cb49f65413028b57f8fc7daa.tar
JRummikub-8a3439f7369e4059cb49f65413028b57f8fc7daa.zip
Ehhhhh... fix stone positions in the correct place.
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@204 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub')
-rw-r--r--src/jrummikub/control/RoundControl.java11
-rw-r--r--src/jrummikub/control/TurnControl.java21
2 files changed, 16 insertions, 16 deletions
diff --git a/src/jrummikub/control/RoundControl.java b/src/jrummikub/control/RoundControl.java
index 154fcb9..f536acc 100644
--- a/src/jrummikub/control/RoundControl.java
+++ b/src/jrummikub/control/RoundControl.java
@@ -73,17 +73,14 @@ public class RoundControl {
for (int i = 0; i < gameState.getPlayerCount(); i++) {
IHand hand = gameState.getNthNextPlayer(i).getHand();
for (int j = 0; j < 7; j++) {
- hand.drop(gameState.getGameHeap().drawStone(), new Position(j,
- 0));
- hand.drop(gameState.getGameHeap().drawStone(), new Position(j,
- 1));
+ hand.drop(gameState.getGameHeap().drawStone(), new Position(j, 0));
+ hand.drop(gameState.getGameHeap().drawStone(), new Position(j, 1));
}
}
}
private void endOfTurn() {
- Set<Stone> tableDiff = tableDifference(gameState.getTable(),
- clonedTable);
+ Set<Stone> tableDiff = tableDifference(gameState.getTable(), clonedTable);
if (!tableDiff.isEmpty()) { // Player has made a move
if (clonedTable.isValid()) {
@@ -131,7 +128,7 @@ public class RoundControl {
.getActivePlayer()
.getHand()
.drop(gameState.getGameHeap().drawStone(),
- new Position(7 + (int) (Math.random() * 6), 0.5f));
+ new Position(HAND_WIDTH - 1, HAND_HEIGHT - 1));
}
private void dealPenalty(int count) {
diff --git a/src/jrummikub/control/TurnControl.java b/src/jrummikub/control/TurnControl.java
index e82b30f..0f8f776 100644
--- a/src/jrummikub/control/TurnControl.java
+++ b/src/jrummikub/control/TurnControl.java
@@ -24,8 +24,7 @@ public class TurnControl {
static class HandStonePositionComparator implements
Comparator<Pair<Stone, Position>> {
@Override
- public int compare(Pair<Stone, Position> pair1,
- Pair<Stone, Position> pair2) {
+ public int compare(Pair<Stone, Position> pair1, Pair<Stone, Position> pair2) {
Position pos1 = pair1.getSecond(), pos2 = pair2.getSecond();
if (pos1.getY() < pos2.getY()) {
return -1;
@@ -81,8 +80,8 @@ public class TurnControl {
connections.add(view.getPlayerPanel().getEndTurnEvent()
.add(endOfTurnListener));
- connections.add(view.getPlayerPanel().getHandPanel()
- .getStoneClickEvent().add(new IListener2<Stone, Boolean>() {
+ connections.add(view.getPlayerPanel().getHandPanel().getStoneClickEvent()
+ .add(new IListener2<Stone, Boolean>() {
@Override
public void handle(Stone stone, Boolean collect) {
@@ -90,8 +89,8 @@ public class TurnControl {
}
}));
- connections.add(view.getPlayerPanel().getHandPanel()
- .getRangeClickEvent().add(new IListener2<Stone, Boolean>() {
+ connections.add(view.getPlayerPanel().getHandPanel().getRangeClickEvent()
+ .add(new IListener2<Stone, Boolean>() {
@Override
public void handle(Stone stone, Boolean collect) {
@@ -348,11 +347,15 @@ public class TurnControl {
table.drop(joinedSet, newPos);
} else {
StoneSet joinedSet = new StoneSet(selectedStones).join(newSet);
- table.drop(joinedSet, new Position(newPos.getX()
- - selectedStones.size(), newPos.getY()));
+ table.drop(joinedSet,
+ new Position(newPos.getX() - selectedStones.size(), newPos.getY()));
}
} else {
- table.drop(new StoneSet(selectedStones), new Position(RoundControl.HAND_WIDTH-1, RoundControl.HAND_HEIGHT-1));
+ table.drop(
+ new StoneSet(selectedStones),
+ new Position(
+ pos.getX() + (set.size() - selectedStones.size()) * 0.5f, pos
+ .getY()));
}
selectedStones.clear();