aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/fr
diff options
context:
space:
mode:
authorAdam NAILI2018-01-12 00:21:27 +0100
committerAdam NAILI2018-01-12 00:21:27 +0100
commitaa1efc9c6e164226d1f47fcaecd5c7cf47040943 (patch)
tree8dd8bfbc5f8c65863f2b2f91c879210cf6c5d950 /src/main/java/fr
parente33c61d4a6dfba20c1dd69d1a22b55b23a9cf940 (diff)
downloadwallj-aa1efc9c6e164226d1f47fcaecd5c7cf47040943.tar.gz
Modifying BoardConverter method due to TileVec2 modification and successful tests
Diffstat (limited to 'src/main/java/fr')
-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);