From 9a3a01c08251665512f75c193517ce64d7a27216 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Thu, 30 Nov 2017 18:40:13 +0100 Subject: [PATCH] Added more stuff in test. We are still missing the actual function to place a structure on the map, but we are quite close. --- java/Map.java | 1 + java/Structure.java | 2 +- java/Test.java | 11 ++++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/java/Map.java b/java/Map.java index 373bf1e..d7ff9ee 100644 --- a/java/Map.java +++ b/java/Map.java @@ -27,6 +27,7 @@ public class Map { this.placeStructure(structure, x, y); } } + System.out.println("Invalid structure name."); } private void placeStructure(Structure structure, int x, int y) { diff --git a/java/Structure.java b/java/Structure.java index 9f11e9b..bbc2b23 100644 --- a/java/Structure.java +++ b/java/Structure.java @@ -1,7 +1,7 @@ import java.util.ArrayList; public class Structure { - private static ArrayList structures; + private static ArrayList structures = new ArrayList(); private Tile[][] tiles; private String name; diff --git a/java/Test.java b/java/Test.java index b92d3d8..6f18f75 100644 --- a/java/Test.java +++ b/java/Test.java @@ -1,8 +1,13 @@ public class Test { public static void main(String[] args) { - Tile wall = new Tile('#', true, "NONE"); - Tile empty = new Tile('+', false, "NONE"); - Map map = new Map(50, 5, 5, 5, empty, wall); + Tile rock = new Tile('#', true, "NONE"); + Tile empty = new Tile(' ', false, "NONE"); + Map map = new Map(50, 5, 5, 5, empty, rock); + Tile wall = new Tile('=', true, "NONE"); + Tile door = new Tile('_', false, "TELEPORT", 0, 0); + Tile[][] tiles = {{wall, wall, wall}, {wall, wall, wall}, {wall, door, wall}}; + Structure structure = new Structure("House", tiles); + map.generateStructure("House", 10, 10); System.out.println(map); } } \ No newline at end of file