From 3ff7f6af6e3653febd3a58ebb35f3a10b774ad73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 13 Sep 2018 16:38:47 +0200 Subject: Board : don't need cols and rows --- core/src/ch/asynk/zproject/engine/board/BoardFactory.java | 12 ++++++------ core/src/ch/asynk/zproject/engine/board/HexBoard.java | 6 +----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/core/src/ch/asynk/zproject/engine/board/BoardFactory.java b/core/src/ch/asynk/zproject/engine/board/BoardFactory.java index a81e963..695d33e 100644 --- a/core/src/ch/asynk/zproject/engine/board/BoardFactory.java +++ b/core/src/ch/asynk/zproject/engine/board/BoardFactory.java @@ -15,22 +15,22 @@ public class BoardFactory HORIZONTAL, } - public static Board getBoard(BoardType boardType, int cols, int rows, float side) + public static Board getBoard(BoardType boardType, float side) { - return getBoard(boardType, cols, rows, side, 0f, 0f, BoardOrientation.VERTICAL); + return getBoard(boardType, side, 0f, 0f, BoardOrientation.VERTICAL); } - public static Board getBoard(BoardType boardType, int cols, int rows, float side, float x0, float y0) + public static Board getBoard(BoardType boardType, float side, float x0, float y0) { - return getBoard(boardType, cols, rows, side, x0, y0, BoardOrientation.VERTICAL); + return getBoard(boardType, side, x0, y0, BoardOrientation.VERTICAL); } - public static Board getBoard(BoardType boardType, int cols, int rows, float side, float x0, float y0, BoardOrientation boardOrientation) + public static Board getBoard(BoardType boardType, float side, float x0, float y0, BoardOrientation boardOrientation) { switch(boardType) { case HEX: - return new HexBoard(cols, rows, side, x0, y0, boardOrientation); + return new HexBoard(side, x0, y0, boardOrientation); default: throw new RuntimeException( String.format("%s board type is not implemented yet.", boardType) ); } diff --git a/core/src/ch/asynk/zproject/engine/board/HexBoard.java b/core/src/ch/asynk/zproject/engine/board/HexBoard.java index 24ce535..c279d16 100644 --- a/core/src/ch/asynk/zproject/engine/board/HexBoard.java +++ b/core/src/ch/asynk/zproject/engine/board/HexBoard.java @@ -6,8 +6,6 @@ import ch.asynk.zproject.engine.Board; public class HexBoard implements Board { - private int cols; // # columns - private int rows; // # rows private float side; // length of the side of the hex private float x0; // bottom left x offset private float y0; // bottom left y offset @@ -37,10 +35,8 @@ public class HexBoard implements Board // rows are vertical° // bottom left is the left vertice of the most bottom-left horizontal hex side of the map - public HexBoard(int cols, int rows, float side, float x0, float y0, BoardFactory.BoardOrientation boardOrientation) + public HexBoard(float side, float x0, float y0, BoardFactory.BoardOrientation boardOrientation) { - this.cols = cols; - this.rows = rows; this.side = side; this.x0 = x0; this.y0 = y0; -- cgit v1.1-2-g2b99