aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-05-07 19:05:16 +0200
committerLinnea Gräf <nea@nea.moe>2024-05-07 19:05:16 +0200
commitd47a3e8633fbeca3ef4e733a1238ef38b7a5c6e6 (patch)
tree421f1e673642c193aa2cc5c78e1d26493ae95f16
parent2ab7f403b38690614b7ac27f5e6ac60b991c0375 (diff)
downloadfirmament-d47a3e8633fbeca3ef4e733a1238ef38b7a5c6e6.tar.gz
firmament-d47a3e8633fbeca3ef4e733a1238ef38b7a5c6e6.tar.bz2
firmament-d47a3e8633fbeca3ef4e733a1238ef38b7a5c6e6.zip
Fix wrapping with ordered waypoints
-rw-r--r--src/main/kotlin/moe/nea/firmament/features/world/Waypoints.kt2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/features/world/Waypoints.kt b/src/main/kotlin/moe/nea/firmament/features/world/Waypoints.kt
index 5d75731..b41c31a 100644
--- a/src/main/kotlin/moe/nea/firmament/features/world/Waypoints.kt
+++ b/src/main/kotlin/moe/nea/firmament/features/world/Waypoints.kt
@@ -256,7 +256,7 @@ fun <E> List<E>.wrappingWindow(startIndex: Int, windowSize: Int): List<E> {
result.addAll(subList(startIndex, startIndex + windowSize))
} else {
result.addAll(subList(startIndex, size))
- result.addAll(subList(0, minOf(size - startIndex - windowSize, startIndex)))
+ result.addAll(subList(0, minOf(windowSize - (size - startIndex), startIndex)))
}
return result
}