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 <gpe@openrs2.org>
bzip2
Graham 4 years ago
parent 55870e428e
commit 9a672153f9
  1. 10
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt

@ -362,7 +362,7 @@ public class CacheImporter @Inject constructor(
masterIndexId = rows.getInt(1) masterIndexId = rows.getInt(1)
} }
if (masterIndexId != null && !overwrite) { if (masterIndexId != null) {
val oldGameId = rows.getInt(2) val oldGameId = rows.getInt(2)
var oldBuild: Int? = rows.getInt(3) var oldBuild: Int? = rows.getInt(3)
@ -396,7 +396,9 @@ public class CacheImporter @Inject constructor(
newTimestamp = timestamp newTimestamp = timestamp
} }
if (oldName != null && name != null) { if (overwrite) {
newName = name
} else if (oldName != null && name != null) {
newName = "$oldName/$name" newName = "$oldName/$name"
} else if (oldName != null) { } else if (oldName != null) {
newName = oldName newName = oldName
@ -404,7 +406,9 @@ public class CacheImporter @Inject constructor(
newName = name newName = name
} }
if (oldDescription != null && description != null) { if (overwrite) {
newDescription = description
} else if (oldDescription != null && description != null) {
newDescription = "$oldDescription\n\n$description" newDescription = "$oldDescription\n\n$description"
} else if (oldDescription != null) { } else if (oldDescription != null) {
newDescription = oldDescription newDescription = oldDescription

Loading…
Cancel
Save