diff options
-rw-r--r-- | play.js | 12 | ||||
-rw-r--r-- | rules.js | 8 |
2 files changed, 15 insertions, 5 deletions
@@ -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 */ @@ -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 } |