Skip to content
Snippets Groups Projects
Commit 85d66f16 authored by plojolo's avatar plojolo
Browse files

suppression de l'ancienne position des firefighter

parent 977c2822
No related branches found
No related tags found
No related merge requests found
Pipeline #24853 failed
...@@ -63,6 +63,9 @@ public class FirefighterBoard implements Board<List<ModelElement>> { ...@@ -63,6 +63,9 @@ public class FirefighterBoard implements Board<List<ModelElement>> {
public List<Position> updateToNextGeneration() { public List<Position> updateToNextGeneration() {
List<Position> modifiedElements;
modifiedElements = fireFighters.firefighterPositions;
fireFighters.nextMove(); fireFighters.nextMove();
//System.out.println(fireFighters.firefighterPositions); //System.out.println(fireFighters.firefighterPositions);
...@@ -77,13 +80,13 @@ public class FirefighterBoard implements Board<List<ModelElement>> { ...@@ -77,13 +80,13 @@ public class FirefighterBoard implements Board<List<ModelElement>> {
fire.nextMove(); fire.nextMove();
step++; step++;
List<Position> result = new ArrayList<>();
result.addAll(fire.firePositions);
result.addAll(fireFighters.firefighterPositions);
result.addAll(cloud.cloudPositions);
return result; modifiedElements.addAll(fire.firePositions);
modifiedElements.addAll(fireFighters.firefighterPositions);
modifiedElements.addAll(cloud.cloudPositions);
return modifiedElements;
} }
@Override @Override
......
...@@ -19,18 +19,18 @@ public class FirefighterGrid extends Canvas implements Grid<ViewElement>{ ...@@ -19,18 +19,18 @@ public class FirefighterGrid extends Canvas implements Grid<ViewElement>{
@Override @Override
public void repaint(List<Pair<Position, ViewElement>> positionedElements) { public void repaint(List<Pair<Position, ViewElement>> positionedElements) {
clear(); clear(positionedElements);
paint(positionedElements); paint(positionedElements);
paintLines(); paintLines();
} }
/*
private void clear(List<Pair<Position, ViewElement>> positionedElements) { private void clear(List<Pair<Position, ViewElement>> positionedElements) {
for (Pair<Position, ViewElement> positionElement : positionedElements) { for (Pair<Position, ViewElement> positionElement : positionedElements) {
Position position = positionElement.getKey(); Position position = positionElement.getKey();
clearSquare(position.row(), position.column()); clearSquare(position.row(), position.column());
} }
} }
*/
private void paint(List<Pair<Position, ViewElement>> positionedElements) { private void paint(List<Pair<Position, ViewElement>> positionedElements) {
for(Pair<Position, ViewElement> pair : positionedElements){ for(Pair<Position, ViewElement> pair : positionedElements){
...@@ -91,9 +91,9 @@ public class FirefighterGrid extends Canvas implements Grid<ViewElement>{ ...@@ -91,9 +91,9 @@ public class FirefighterGrid extends Canvas implements Grid<ViewElement>{
getGraphicsContext2D().setFill(color); getGraphicsContext2D().setFill(color);
getGraphicsContext2D().fillRect(row*squareHeight,column*squareWidth,squareHeight,squareWidth); getGraphicsContext2D().fillRect(row*squareHeight,column*squareWidth,squareHeight,squareWidth);
} }
/*
private void clearSquare(int row, int column){ private void clearSquare(int row, int column){
getGraphicsContext2D().clearRect(row*squareHeight,column*squareWidth,squareHeight,squareWidth); getGraphicsContext2D().clearRect(row*squareHeight,column*squareWidth,squareHeight,squareWidth);
} }
*/
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment