Commit 13b3e459 authored by Quentin DRUAULT-AUBIN's avatar Quentin DRUAULT-AUBIN
Browse files

[Ship] Fix place ship on board

parent 3e011626
......@@ -5,19 +5,14 @@
*/
package com.utclo23.ihmtable;
import com.utclo23.data.facade.DataFacade;
import com.utclo23.data.structure.Coordinate;
import com.utclo23.data.structure.StatGame;
import com.utclo23.data.facade.IDataIHMTable;
import com.utclo23.data.structure.Game;
import com.utclo23.data.structure.LightPublicUser;
import com.utclo23.data.structure.Ship;
import com.utclo23.ihmmain.controller.AbstractController;
import com.utclo23.ihmmain.facade.IHMMainToIhmTable;
import com.utclo23.ihmtable.controller.InGameGUIController;
import java.io.IOException;
import java.rmi.server.UID;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.fxml.FXMLLoader;
......
......@@ -479,7 +479,16 @@ public class InGameGUIController {
shipOnTheGrid.setFitWidth(grid.getWidth()/10.0 * ship.getSize());
shipOnTheGrid.setFitHeight(grid.getHeight()/10.0);
// Place on the grid.
grid.add(shipOnTheGrid, Math.min(ship.getListCoord().get(0).getX(), ship.getListCoord().get(1).getX()), ship.getListCoord().get(0).getY(), ship.getSize(), 1);
grid.add(
shipOnTheGrid,
Math.min(
ship.getListCoord().get(0).getX(),
ship.getListCoord().get(ship.getListCoord().size() - 1).getX()
),
ship.getListCoord().get(0).getY(),
ship.getSize(),
1
);
} else {
// Vertical
// Set the size.
......@@ -488,7 +497,15 @@ public class InGameGUIController {
// Rotate the image.
shipOnTheGrid.setRotate(90);
// Place on the grid.
grid.add(shipOnTheGrid, ship.getListCoord().get(0).getX(), Math.min(ship.getListCoord().get(0).getY(), ship.getListCoord().get(1).getY()), 1, ship.getSize());
grid.add(
shipOnTheGrid,
ship.getListCoord().get(0).getX(),
Math.min(
ship.getListCoord().get(0).getY(),
ship.getListCoord().get(ship.getListCoord().size() - 1).getY()
),
1,
ship.getSize());
}
return shipOnTheGrid;
......
Supports Markdown
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