diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameSaver.java b/core/src/ru/deadsoftware/cavecraft/game/GameSaver.java
index a4e314b465273705b1cc404d44918080ef0b7f26..00d91bf3b4ec9f50860cdcbb1969c44c8dbc5f64 100644 (file)
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));
return gameProc;
}
- public static void save(GameProc gameProc) {
+ public static void save(GameProc gp) {
FileHandle file = Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/");
file.mkdirs();
file = Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/game.sav");
try {
ObjectOutputStream out = new ObjectOutputStream(file.write(false));
out.writeInt(VERSION);
- out.writeObject(gameProc);
+ out.writeObject(gp);
out.close();
- saveMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/foremap.sav"), gameProc.world.getFullForeMap());
- saveMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/backmap.sav"), gameProc.world.getFullBackMap());
+ saveMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/foremap.sav"), gp.world.getFullForeMap());
+ saveMap(Gdx.files.absolute(CaveGame.GAME_FOLDER + "/saves/backmap.sav"), gp.world.getFullBackMap());
} catch (Exception e) {
e.printStackTrace();
}