diff options
author | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-05-02 23:33:46 +0200 |
---|---|---|
committer | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-05-02 23:33:46 +0200 |
commit | e964c53cb66c19d2da77d619020833e9f08536c0 (patch) | |
tree | 5c0b16b55ce21fd850cd4fc213975e66bea0b86c /src | |
parent | 78049911ca8021b3198122d18c47257ada4cf037 (diff) | |
download | JRummikub-e964c53cb66c19d2da77d619020833e9f08536c0.tar JRummikub-e964c53cb66c19d2da77d619020833e9f08536c0.zip |
Rekursives Verschieben getestet und heile gemacht
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@70 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src')
-rw-r--r-- | src/jrummikub/model/StoneTray.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/jrummikub/model/StoneTray.java b/src/jrummikub/model/StoneTray.java index 07719cf..20dde3d 100644 --- a/src/jrummikub/model/StoneTray.java +++ b/src/jrummikub/model/StoneTray.java @@ -15,7 +15,7 @@ import jrummikub.util.Pair; */ public class StoneTray<E extends Sizeable> implements Iterable<Pair<E, Position>> { - protected List<Pair<E, Position>> objects = new ArrayList<Pair<E, Position>>(); + protected ArrayList<Pair<E, Position>> objects = new ArrayList<Pair<E, Position>>(); /** Possible move directions in case of overlapping Stones/Sets */ @@ -68,8 +68,9 @@ public class StoneTray<E extends Sizeable> implements drop(object, position, null); } + @SuppressWarnings("unchecked") private void drop(E object, Position position, Direction direction) { - for (Pair<E, Position> i : objects) { + for (Pair<E, Position> i : (List<Pair<E, Position>>)objects.clone()) { Position currentPosition = i.getSecond(); E currentObject = i.getFirst(); if (!objectsOverlap(object, position, currentObject, @@ -100,6 +101,7 @@ public class StoneTray<E extends Sizeable> implements currentPosition.getY()); break; } + objects.remove(i); drop(currentObject, newPosition, direction); } |