diff options
author | Pacien TRAN-GIRARD | 2015-11-22 17:04:16 +0100 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2015-11-22 17:04:16 +0100 |
commit | 5a730c9d174a8f86b01feea2b389e0231abc1b1d (patch) | |
tree | 851d562ea79f173da92123d43563cbd48eddeac6 /src/ch | |
parent | ab5670348b30fabf63ec77924264ff883b83633f (diff) | |
download | maze-solver-5a730c9d174a8f86b01feea2b389e0231abc1b1d.tar.gz |
Fix concurrent deletion on Maze reset
Diffstat (limited to 'src/ch')
-rw-r--r-- | src/ch/epfl/maze/physical/Maze.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ch/epfl/maze/physical/Maze.java b/src/ch/epfl/maze/physical/Maze.java index e58a56a..bff8791 100644 --- a/src/ch/epfl/maze/physical/Maze.java +++ b/src/ch/epfl/maze/physical/Maze.java | |||
@@ -75,8 +75,9 @@ public final class Maze extends World { | |||
75 | 75 | ||
76 | @Override | 76 | @Override |
77 | public void reset() { | 77 | public void reset() { |
78 | for (Animal a : this.animals) this.removeAnimal(a); | 78 | this.animalHistory.addAll(this.animals); |
79 | for (Animal a : this.animalHistory) this.addAnimal(a.copy()); | 79 | this.animals.clear(); |
80 | this.animalHistory.forEach(a -> this.addAnimal(a.copy())); | ||
80 | this.animalHistory.clear(); | 81 | this.animalHistory.clear(); |
81 | } | 82 | } |
82 | } | 83 | } |