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)

This commit is contained in:
Yair Morgenstern 2019-02-07 23:06:13 +02:00
parent 50931a86c1
commit d42416974c

View File

@ -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
}