diff options
author | Nao Pross <naopross@thearcway.org> | 2018-11-19 10:27:15 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-11-19 10:27:15 +0100 |
commit | 7a7007571699eb57bc96cef4cd053a5bd50468b3 (patch) | |
tree | 14b879b399417a59a340c6fda9daf4719a3dbebf /src/MapLoader.java | |
parent | Add Actor.SkillSet, remove useless members in various strucutres (diff) | |
download | Subconscious-java-7a7007571699eb57bc96cef4cd053a5bd50468b3.tar.gz Subconscious-java-7a7007571699eb57bc96cef4cd053a5bd50468b3.zip |
Update Scene class (and some derivates) to be abstract
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) { |