Commit 5f55c96a authored by Hugo DACLON's avatar Hugo DACLON
Browse files

appli qui fonctionne (j'espere)

parent 3b184a87
...@@ -249,17 +249,14 @@ public class CreationFlotte extends JPanel {// JPanel { ...@@ -249,17 +249,14 @@ public class CreationFlotte extends JPanel {// JPanel {
selectedCell = null; selectedCell = null;
throw new CoordsBadShipException(); throw new CoordsBadShipException();
} }
for (IShip flotteShip : appli.getFlotte().getShips()) {
for (ICoord c : newShip.getCoords()) {
if (flotteShip.getCoords().contains(c)) {
selectedCell = null;
throw new CoordsBadShipException();
}
}
}
selectedCell = null; selectedCell = null;
appli.getFlotte().add(newShip); switch (appli.getFlotte().add(newShip)){
map.ajouterBateau(newShip); case 0 :
map.ajouterBateau(newShip);
break;
default :
throw new CoordsBadShipException();
}
} }
private boolean isVertical(Coord cell) { private boolean isVertical(Coord cell) {
...@@ -370,4 +367,9 @@ public class CreationFlotte extends JPanel {// JPanel { ...@@ -370,4 +367,9 @@ public class CreationFlotte extends JPanel {// JPanel {
public void fixeListenerRefresh(ActionListener l) { public void fixeListenerRefresh(ActionListener l) {
refresh.addActionListener(l); refresh.addActionListener(l);
} }
public void actualiserMap() {
map.resetGrille();
map.ajouterFlotte(appli.getFlotte());
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment