summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/control')
-rw-r--r--src/jrummikub/control/turn/HumanTurnControl.java33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/jrummikub/control/turn/HumanTurnControl.java b/src/jrummikub/control/turn/HumanTurnControl.java
index 7b2588e..f13b3a2 100644
--- a/src/jrummikub/control/turn/HumanTurnControl.java
+++ b/src/jrummikub/control/turn/HumanTurnControl.java
@@ -110,12 +110,13 @@ public class HumanTurnControl extends AbstractTurnControl {
}
}));
- connections.add(view.getPlayerPanel().getRedealEvent().add(new IListener() {
- @Override
- public void handle() {
- endOfTurn(true);
- }
- }));
+ connections.add(view.getPlayerPanel().getRedealEvent()
+ .add(new IListener() {
+ @Override
+ public void handle() {
+ endOfTurn(true);
+ }
+ }));
}
private void addHandPanelHandlers() {
@@ -233,9 +234,10 @@ public class HumanTurnControl extends AbstractTurnControl {
int i = 0;
for (Stone s : handStones) {
- float x = Math.max(0,
+ double x = Math.max(0,
Math.min(13, pos.getX() - handStones.size() / 2.0f + i));
- player.getHand().drop(s, new Position(x, (float) Math.floor(pos.getY())));
+ player.getHand().drop(s,
+ new Position(x, (float) Math.floor(pos.getY())));
selectedStones.remove(s);
i++;
}
@@ -432,13 +434,15 @@ public class HumanTurnControl extends AbstractTurnControl {
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(pos.getX() + (set.getSize() - selectedStones.size())
- * 0.5f, pos.getY()));
+ table.drop(
+ new StoneSet(selectedStones),
+ new Position(pos.getX()
+ + (set.getSize() - selectedStones.size()) * 0.5f,
+ pos.getY()));
}
selectedStones.clear();
@@ -533,7 +537,8 @@ public class HumanTurnControl extends AbstractTurnControl {
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;