aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/fr/umlv/java/wallj/board/BoardConverter.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/fr/umlv/java/wallj/board/BoardConverter.java b/src/main/java/fr/umlv/java/wallj/board/BoardConverter.java
index 0f8359b..6231875 100644
--- a/src/main/java/fr/umlv/java/wallj/board/BoardConverter.java
+++ b/src/main/java/fr/umlv/java/wallj/board/BoardConverter.java
@@ -14,8 +14,8 @@ public final class BoardConverter {
14 } 14 }
15 15
16 public static Board worldToBoard(List<Block> blocks) { 16 public static Board worldToBoard(List<Block> blocks) {
17 int width = blocks.stream().map(Block::getTile).mapToInt(TileVec2::getRow).max().orElse(-1) + 1; 17 int width = blocks.stream().map(Block::getTile).mapToInt(TileVec2::getCol).max().orElse(-1) + 1;
18 int height = blocks.stream().map(Block::getTile).mapToInt(TileVec2::getCol).max().orElse(-1) + 1; 18 int height = blocks.stream().map(Block::getTile).mapToInt(TileVec2::getRow).max().orElse(-1) + 1;
19 19
20 Board.Builder builder = new Board.Builder(width, height); 20 Board.Builder builder = new Board.Builder(width, height);
21 for (Block block : blocks) { 21 for (Block block : blocks) {
@@ -29,9 +29,9 @@ public final class BoardConverter {
29 int nbRow = board.getDim().getRow(); 29 int nbRow = board.getDim().getRow();
30 int nbCol = board.getDim().getCol(); 30 int nbCol = board.getDim().getCol();
31 for (int i = 0; i < nbRow; i++) { 31 for (int i = 0; i < nbRow; i++) {
32 for (int j = 0; i < nbCol; j++) { 32 for (int j = 0; j < nbCol; j++) {
33 Block block; 33 Block block;
34 TileVec2 location = TileVec2.of(i, j); 34 TileVec2 location = TileVec2.of(j,i);
35 block = BlockFactory.build(board.getBlockTypeAt(location), location); 35 block = BlockFactory.build(board.getBlockTypeAt(location), location);
36 if (block != null) { 36 if (block != null) {
37 blocks.add(block); 37 blocks.add(block);