diff options
author | Ida Massow <massow@informatik.uni-luebeck.de> | 2011-06-06 19:53:45 +0200 |
---|---|---|
committer | Ida Massow <massow@informatik.uni-luebeck.de> | 2011-06-06 19:53:45 +0200 |
commit | 682357b5841f7853212e354199d1a46589663364 (patch) | |
tree | 7a383625543dbfdedf297a97c927a518a38b30d3 /src/jrummikub/control/turn | |
parent | 41786cb8423167fe5488931c695404f2b38b19f9 (diff) | |
download | JRummikub-682357b5841f7853212e354199d1a46589663364.tar JRummikub-682357b5841f7853212e354199d1a46589663364.zip |
Double ist das neue float
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@377 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/control/turn')
-rw-r--r-- | src/jrummikub/control/turn/HumanTurnControl.java | 33 |
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; |