internal - Enable writing new format of civ ranking history

This commit is contained in:
yairm210 2024-09-23 23:57:54 +03:00
parent 9c7e5b3ae6
commit 4394dcda7a

View File

@ -31,17 +31,9 @@ class CivRankingHistory : HashMap<Int, Map<RankingType, Int>>(), IsPartOfGameInf
override fun write(json: Json) {
for ((turn, rankings) in this) {
// Old format - deprecated 4.12.18
json.writeObjectStart(turn.toString())
for ((rankingType, score) in rankings) {
json.writeValue(rankingType.idForSerialization.toString(), score)
}
json.writeObjectEnd()
// New format (disabled)
// val rankingsString = rankings.entries
// .joinToString("") { it.key.idForSerialization.toString() + it.value }
// json.writeValue(turn.toString(), rankingsString)
val rankingsString = rankings.entries
.joinToString("") { it.key.idForSerialization.toString() + it.value }
json.writeValue(turn.toString(), rankingsString)
}
}