diff --git a/HeatUp/src/de/heatup/mapengine/MapEngine.java b/HeatUp/src/de/heatup/mapengine/MapEngine.java index e174586..850c9e0 100644 --- a/HeatUp/src/de/heatup/mapengine/MapEngine.java +++ b/HeatUp/src/de/heatup/mapengine/MapEngine.java @@ -11,6 +11,7 @@ import java.util.Scanner; import javax.swing.JPanel; import de.heatup.cfg.Config; +import de.heatup.highscore.HighscoreHandler; import de.heatup.logging.Logger; import de.heatup.objects.*; /** @@ -31,6 +32,10 @@ public class MapEngine { private final int gamePanelWidth = Config.gamePanelWidth; + private static String mapString = ""; + + private final HighscoreHandler mapHighscore; + HashMap> allMapTiles = new HashMap>(); ArrayList availableHardwareTileTypes = new ArrayList(); /** @@ -39,28 +44,26 @@ public class MapEngine { */ public MapEngine(int mapNumber) { Scanner input = null; - try { - input = new Scanner(MapLoader.loadMap(mapNumber)); - } catch (FileNotFoundException e) { - Logger.write("Could not find map file"); - System.exit(-1); - e.printStackTrace(); - } + MapLoader ml = new MapLoader(); + input = new Scanner(ml.loadMap(mapNumber)); this.createTiles(input); + mapHighscore = new HighscoreHandler(mapString); } /** * Öffnet einen File Chooser um eine Custom Map auszuwählen, welche anschließend geladen wird. */ public MapEngine() { Scanner input = null; + MapLoader ml = new MapLoader(); try { - input = new Scanner(MapLoader.chooseMap()); + input = new Scanner(ml.chooseMap()); } catch (FileNotFoundException e) { Logger.write("Map file not found"); e.printStackTrace(); } this.createTiles(input); + mapHighscore = new HighscoreHandler(mapString); } /** * Erstellt aus einem gegebenen Scanner, welche eine Datei einliest, @@ -73,6 +76,7 @@ public class MapEngine { int y = 0; while (input.hasNextLine() && lineCount <= mapHeight) { String currentLine = input.nextLine(); + mapString = mapString+currentLine; for (int i = 0; i