mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04: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) {
|
fun saveGame(game: GameInfo, GameName: String) {
|
||||||
getSave(GameName).writeString(json().toJson(game), false)
|
json().toJson(game,getSave(GameName))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadGame(GameName: String) : GameInfo {
|
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()
|
game.setTransients()
|
||||||
return game
|
return game
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user