From 9a672153f945dd24daa89822fd78f3193f917cdc Mon Sep 17 00:00:00 2001 From: Graham Date: Thu, 4 Mar 2021 22:19:43 +0000 Subject: [PATCH] Change the overwrite flag to only overwrite the name/description We still want to merge the build and timestamp as caches can be associated with multiple build numbers, and I always want us to use the earliest number. Signed-off-by: Graham --- .../kotlin/org/openrs2/archive/cache/CacheImporter.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt b/archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt index 3927aa79..18c0a529 100644 --- a/archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt +++ b/archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt @@ -362,7 +362,7 @@ public class CacheImporter @Inject constructor( masterIndexId = rows.getInt(1) } - if (masterIndexId != null && !overwrite) { + if (masterIndexId != null) { val oldGameId = rows.getInt(2) var oldBuild: Int? = rows.getInt(3) @@ -396,7 +396,9 @@ public class CacheImporter @Inject constructor( newTimestamp = timestamp } - if (oldName != null && name != null) { + if (overwrite) { + newName = name + } else if (oldName != null && name != null) { newName = "$oldName/$name" } else if (oldName != null) { newName = oldName @@ -404,7 +406,9 @@ public class CacheImporter @Inject constructor( newName = name } - if (oldDescription != null && description != null) { + if (overwrite) { + newDescription = description + } else if (oldDescription != null && description != null) { newDescription = "$oldDescription\n\n$description" } else if (oldDescription != null) { newDescription = oldDescription