From eaadc13a3b267eb75dfe2e4871fc9d78030472d2 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 4 Aug 2024 18:11:05 +0200 Subject: eslint dead code --- play.js | 51 ++------------------------------------------------- 1 file changed, 2 insertions(+), 49 deletions(-) diff --git a/play.js b/play.js index 9917428..c317507 100644 --- a/play.js +++ b/play.js @@ -1,7 +1,7 @@ "use strict" /* - global view, data, player, send_action, action_button, scroll_with_middle_mouse + global view, data, roles, send_action, action_button */ /* COMMON */ @@ -22,25 +22,8 @@ function set_has(set, item) { return false } -function map_get(map, key, missing) { - let a = 0 - let b = (map.length >> 1) - 1 - while (a <= b) { - let m = (a + b) >> 1 - let x = map[m << 1] - if (key < x) - b = m - 1 - else if (key > x) - a = m + 1 - else - return map[(m << 1) + 1] - } - return missing -} - /* DATA */ -const PC_NONE = 0 const PC_BRITISH = 1 const PC_AMERICAN = 2 @@ -51,13 +34,8 @@ const CU_BRITISH_MASK = 63 << CU_BRITISH_SHIFT const CU_AMERICAN_MASK = 63 << CU_AMERICAN_SHIFT const CU_FRENCH_MASK = 7 << CU_FRENCH_SHIFT -const GENERALS = data.generals const CARDS = data.cards -const SPACES = data.spaces -const COLONIES = data.colonies -const BOXES = data.layout -const BLOCKADE_ZONES = [ 0, 1, 2, 3, 4, 5, 6 ] const P_BRITAIN = "Britain" const P_AMERICA = "America" @@ -65,20 +43,12 @@ const F_REGULARS = 2 const F_EUROPEAN_WAR = 4 const F_MUTINIES = 16 -const space_count = 66 const general_count = data.generals.length -const CAPTURED_GENERALS = data.space_index["Captured Generals"] const CONTINENTAL_CONGRESS_DISPERSED = data.space_index["Continental Congress Dispersed"] -const BRITISH_REINFORCEMENTS = data.space_index["British Reinforcement Box"] -const AMERICAN_REINFORCEMENTS = data.space_index["American Leader Reinforcements"] const FRENCH_REINFORCEMENTS = data.space_index["French Reinforcements"] const NOWHERE = data.spaces.length -function is_british_general(g) { - return g >= 8 -} - /* ACCESSORS */ function get_space_pc(space) { @@ -142,7 +112,6 @@ function animate_position(e) { dy = e.my_y - rect.y } if (dx !== 0 || dy !== 0) { - let dist = Math.sqrt((dx * dx) + (dy * dy)) e.animate( [ { transform: `translate(${dx}px, ${dy}px)`, }, @@ -191,13 +160,6 @@ let ui = { generals: [], } -function create(t, p, ...c) { - let e = document.createElement(t) - Object.assign(e, p) - e.append(c) - return e -} - let action_register = [] function register_action(target, action, id) { @@ -348,15 +310,6 @@ function toggle_marker(e, cond) { show_marker(e) } -function toggle_marker_with_number(e, n) { - if (n > 0) { - show_marker(e) - e.textContent = n - } else { - e.textContent = 0 - } -} - function show_marker_at(e, x, y) { show_marker(e) e.style.left = x - e.my_dx + "px" @@ -838,7 +791,7 @@ function on_focus_card_tip(s) { ui.last_played.className = "card shrink card_" + s } -function on_blur_card_tip(s) { +function on_blur_card_tip() { ui.last_played.className = "card shrink card_" + view.last_played } -- cgit v1.2.3