From 6025d8b13cec992dea120561017952353dc9aa76 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Thu, 14 Dec 2023 14:54:32 +0900 Subject: [PATCH] fix: autosave is not loading --- src/net/torvald/terrarum/SavegameCollection.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/net/torvald/terrarum/SavegameCollection.kt b/src/net/torvald/terrarum/SavegameCollection.kt index f0effda41..9ed762484 100644 --- a/src/net/torvald/terrarum/SavegameCollection.kt +++ b/src/net/torvald/terrarum/SavegameCollection.kt @@ -26,10 +26,10 @@ import kotlin.math.roundToInt /** * Created by minjaesong on 2023-06-24. */ -class SavegameCollection(files0: List, prefiltered: Boolean) { +class SavegameCollection(files0: List) { /** Sorted in reverse by the last modified time of the files, index zero being the most recent */ - val files = if (prefiltered) files0 else files0.sortedBy { it.diskFile.name }.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) @@ -54,14 +54,14 @@ class SavegameCollection(files0: List, prefiltered: Boolean) { companion object { fun collectFromBaseFilename(skimmers: List, name: String): SavegameCollection { - return SavegameCollection(skimmers, true) + return SavegameCollection(skimmers) } fun collectFromBaseFilename(dir: File, name: String): SavegameCollection { val files = dir.listFiles().filter { it.name.startsWith(name) } .mapNotNull { try { DiskSkimmer(it, true) } catch (e: Throwable) { null } } - return SavegameCollection(files, false) + return SavegameCollection(files) } }