Double ist das neue float

git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@377 72836036-5685-4462-b002-a69064685172
This commit is contained in:
Ida Massow 2011-06-06 19:53:45 +02:00
parent 41786cb842
commit 682357b584
7 changed files with 170 additions and 148 deletions

View file

@ -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;