Always collect on invalid range clicks

git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@224 72836036-5685-4462-b002-a69064685172
This commit is contained in:
Matthias Schiffer 2011-05-10 05:21:59 +02:00
parent 3eae312798
commit 8f47c06e31

View file

@ -36,15 +36,15 @@ public class TurnControl {
private List<Connection> connections = new ArrayList<Connection>();
/**
* Create a new TurnControl using a given hand (of the active player), a
* given table and a given view for user interaction.
* Create a new TurnControl using a given hand (of the active player), a given
* table and a given view for user interaction.
*
* @param hand
* active player's hand
* active player's hand
* @param table
* current table
* current table
* @param view
* view for user interaction.
* view for user interaction.
*/
public TurnControl(IHand hand, ITable table, IView view) {
this.hand = hand;
@ -247,9 +247,8 @@ public class TurnControl {
y++;
if (y >= GameControl.HAND_HEIGHT) {
throw new ArrayIndexOutOfBoundsException(); // TODO We can't
// handle
// this yet...
// TODO We can't handle this yet...
throw new ArrayIndexOutOfBoundsException();
}
}
}
@ -329,14 +328,14 @@ public class TurnControl {
private void tableRangeClick(Stone stone, Boolean collect) {
if (selectedStones.isEmpty()) {
stoneClick(stone, collect);
stoneClick(stone, true);
return;
}
Stone lastStone = selectedStones.get(selectedStones.size() - 1);
StoneSet lastSet = table.findStoneSet(lastStone);
StoneSet selectedSet = table.findStoneSet(stone);
if (lastSet != selectedSet) {
stoneClick(stone, collect);
stoneClick(stone, true);
return;
}
List<Stone> setStones = new ArrayList<Stone>();
@ -361,13 +360,13 @@ public class TurnControl {
private void handRangeClick(Stone stone, Boolean collect) {
if (selectedStones.isEmpty()) {
stoneClick(stone, collect);
stoneClick(stone, true);
return;
}
Stone lastStone = selectedStones.get(selectedStones.size() - 1);
StoneSet lastSet = table.findStoneSet(lastStone);
if (lastSet != null) {
stoneClick(stone, collect);
stoneClick(stone, true);
return;
}
List<Pair<Stone, Position>> handPairs = new ArrayList<Pair<Stone, Position>>();