From 4eb7a8a77e64aa75968224613f25e591443e922f Mon Sep 17 00:00:00 2001 From: minjaesong Date: Wed, 12 Jul 2023 10:00:47 +0900 Subject: [PATCH] fix: if two savegame has identical lastmodifiedtime, file with lower number will be preferred --- src/net/torvald/terrarum/SavegameCollection.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net/torvald/terrarum/SavegameCollection.kt b/src/net/torvald/terrarum/SavegameCollection.kt index 747976058..d2978cea6 100644 --- a/src/net/torvald/terrarum/SavegameCollection.kt +++ b/src/net/torvald/terrarum/SavegameCollection.kt @@ -29,7 +29,7 @@ import kotlin.math.roundToInt class SavegameCollection(files0: List) { /** Sorted in reverse by the last modified time of the files, index zero being the most recent */ - val files = files0.sortedByDescending { + val files = files0.sortedBy { it.diskFile.name }.sortedByDescending { it.getLastModifiedTime().shl(2) or it.diskFile.extension.matches(Regex("^[abc]${'$'}")).toLong(1) or it.diskFile.extension.isBlank().toLong(0)