DEADSOFTWARE

One GameProc object for everything
[cavedroid.git] / core / src / ru / deadsoftware / cavecraft / game / GameSaver.java
index c4e13a640a737ec58b8bf1a1a9bb6c425a42c2c5..5f8743dc8710a3f054b597fea29a9be5a19e6538 100644 (file)
@@ -23,10 +23,10 @@ public class GameSaver {
         out.write(intToBytes(VERSION));
         out.write(intToBytes(width));
         out.write(intToBytes(height));
-        for (int y = 0; y < map[0].length; y++) {
+        for (int y = 0; y < height; y++) {
             bl = map[0][y];
             rl = 0;
-            for (int x = 0; x < map.length; x++) {
+            for (int x = 0; x < width; x++) {
                 if (map[x][y] != bl) {
                     out.write(intToBytes(rl));
                     out.write(intToBytes(bl));
@@ -78,7 +78,7 @@ public class GameSaver {
                     loadMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/foremap.sav")),
                     loadMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/backmap.sav"))
             );
-            gameProc.physics = new GamePhysics(gameProc);
+            gameProc.physics = new GamePhysics();
             gameProc.resetRenderer();
         } catch (Exception e) {
             Gdx.app.error("GameSaver", e.getMessage(), e);