diff options
Diffstat (limited to 'src/MapLoader.java')
-rw-r--r-- | src/MapLoader.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/MapLoader.java b/src/MapLoader.java index b55f2ac..4bd4e02 100644 --- a/src/MapLoader.java +++ b/src/MapLoader.java @@ -1,5 +1,6 @@ import java.lang.String; +// TODO: use java.nio? http://tutorials.jenkov.com/java-nio/nio-vs-io.html import java.io.File; import java.io.PrintWriter; import java.io.FileReader; @@ -32,7 +33,7 @@ class MapLoader { try { fr = new FileReader(this.path); bf = new BufferedReader(fr); - // TODO: read all + // TODO: read all at once while ((line = bf.readLine()) != null) { mapText = mapText + line; } @@ -44,10 +45,13 @@ class MapLoader { Gson gson = new Gson(); Map importMap = gson.fromJson(mapText, Map.class); - //update map with new classes - Map map = new Map(new Dimension(importMap.getSize(), importMap.getSize())); - map.update(importMap.getActors(), importMap.getGrid()); - return map; + // TODO: ask @mafaldo why is there a copy? + // update map with new classes + // Map map = new Map(new Dimension(importMap.getSize(), importMap.getSize())); + // map.update(importMap.getActors(), importMap.getGrid()); + // return map; + + return importMap; } public void saveMap(Map map) { |