From 682357b5841f7853212e354199d1a46589663364 Mon Sep 17 00:00:00 2001 From: Ida Massow Date: Mon, 6 Jun 2011 19:53:45 +0200 Subject: Double ist das neue float git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@377 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/control/turn/HumanTurnControl.java | 33 ++++++++++++++---------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'src/jrummikub/control') 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> { @Override - public int compare(Pair pair1, Pair pair2) { + public int compare(Pair pair1, + Pair pair2) { Position pos1 = pair1.getSecond(), pos2 = pair2.getSecond(); if (pos1.getY() < pos2.getY()) { return -1; -- cgit v1.2.3