From 7a7007571699eb57bc96cef4cd053a5bd50468b3 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 19 Nov 2018 10:27:15 +0100 Subject: Update Scene class (and some derivates) to be abstract --- src/MapLoader.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/MapLoader.java') 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) { -- cgit v1.2.1