summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.js12
-rw-r--r--rules.js8
2 files changed, 15 insertions, 5 deletions
diff --git a/play.js b/play.js
index 6948f1d..81531da 100644
--- a/play.js
+++ b/play.js
@@ -5,7 +5,17 @@
*/
function toggle_pieces() {
- document.getElementById("pieces").classList.toggle("hide")
+ // Cycle between showing everything, only pieces, and nothing.
+ let hidden_pieces = ui.pieces_element.classList.contains("hide")
+ let hidden_markers = ui.markers_element.classList.contains("hide")
+ if (hidden_pieces && hidden_markers) {
+ ui.pieces_element.classList.remove("hide")
+ ui.markers_element.classList.remove("hide")
+ } else if (hidden_pieces) {
+ ui.markers_element.classList.add("hide")
+ } else {
+ ui.pieces_element.classList.add("hide")
+ }
}
/* DATA */
diff --git a/rules.js b/rules.js
index b0769df..b0224af 100644
--- a/rules.js
+++ b/rules.js
@@ -231,10 +231,6 @@ const all_power_trains = [
const TRAIN_IA = 32
-function is_general(p) {
- return p < 24
-}
-
const all_pieces = [ ...all_power_generals.flat(), ...all_power_trains.flat() ]
const all_generals = [ ...all_power_generals.flat() ]
@@ -294,6 +290,10 @@ const all_enemy_generals = [
all_prussia_generals,
]
+function is_general(p) {
+ return p < 24
+}
+
function is_supply_train(p) {
return p >= 24
}