From d42416974c06229921e280d6ceca95f37e23bb70 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 7 Feb 2019 23:06:13 +0200 Subject: [PATCH] Saving and loading games is now done directly to\from files without becoming strings in the meantime - should help avoid some OutOfMemory exceptions when the games become really huge (the GameInfo as c# classes is much smaller thatn the serialized text for a number of reasons) --- core/src/com/unciv/logic/GameSaver.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/GameSaver.kt b/core/src/com/unciv/logic/GameSaver.kt index 8f6cc87d1e..01724679db 100644 --- a/core/src/com/unciv/logic/GameSaver.kt +++ b/core/src/com/unciv/logic/GameSaver.kt @@ -34,11 +34,11 @@ class GameSaver { } fun saveGame(game: GameInfo, GameName: String) { - getSave(GameName).writeString(json().toJson(game), false) + json().toJson(game,getSave(GameName)) } fun loadGame(GameName: String) : GameInfo { - val game = json().fromJson(GameInfo::class.java, getSave(GameName).readString()) + val game = json().fromJson(GameInfo::class.java, getSave(GameName)) game.setTransients() return game }