mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-10 04:43:29 +07:00
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:
parent
50931a86c1
commit
d42416974c
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user