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