summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-03-05 23:24:17 +0100
committerTor Andersson <tor@ccxvii.net>2024-03-05 23:24:20 +0100
commitaf3416c206fd74f4138d83f36230f1f8e5c27a72 (patch)
tree06380b28b578325ce3f0f166d2011d4fbb2f9165
parent8f88d543d79421f29c2f67d44006290a24e98d7c (diff)
downloadrommel-in-the-desert-af3416c206fd74f4138d83f36230f1f8e5c27a72.tar.gz
Remove unused return statements from set functions.
-rw-r--r--rules.js22
1 files changed, 12 insertions, 10 deletions
diff --git a/rules.js b/rules.js
index 0bb851a..98d54fe 100644
--- a/rules.js
+++ b/rules.js
@@ -7782,12 +7782,12 @@ function random(range) {
}
// remove item at index (faster than splice)
+
function array_remove(array, index) {
let n = array.length
for (let i = index + 1; i < n; ++i)
array[i - 1] = array[i]
array.length = n - 1
- return array
}
// insert item at index (faster than splice)
@@ -7795,7 +7795,6 @@ function array_insert(array, index, item) {
for (let i = array.length; i > index; --i)
array[i] = array[i - 1]
array[index] = item
- return array
}
function set_clear(set) {
@@ -7829,9 +7828,9 @@ function set_add(set, item) {
else if (item > x)
a = m + 1
else
- return set
+ return
}
- return array_insert(set, a, item)
+ array_insert(set, a, item)
}
function set_delete(set, item) {
@@ -7844,10 +7843,11 @@ function set_delete(set, item) {
b = m - 1
else if (item > x)
a = m + 1
- else
- return array_remove(set, m)
+ else {
+ array_remove(set, m)
+ return
+ }
}
- return set
}
function set_toggle(set, item) {
@@ -7860,10 +7860,12 @@ function set_toggle(set, item) {
b = m - 1
else if (item > x)
a = m + 1
- else
- return array_remove(set, m)
+ else {
+ array_remove(set, m)
+ return
+ }
}
- return array_insert(set, a, item)
+ array_insert(set, a, item)
}
// Fast deep copy for objects without cycles