index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
author | Catalin Mititiuc <webdevcat@proton.me> | 2024-04-27 13:10:43 -0700 |
---|---|---|
committer | Catalin Mititiuc <webdevcat@proton.me> | 2024-04-27 13:10:43 -0700 |
commit | 75a0c37ea5e5a9fa395690984c373536e8efccfa (patch) | |
tree | 808eeee44b89638b0583ba2375388c53be882c2f /src/modules/game.js | |
parent | b88945ced695e8478076c5f53a198fd405f7db96 (diff) |
Some cleanup
Diffstat (limited to 'src/modules/game.js')
-rw-r--r-- | src/modules/game.js | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/modules/game.js b/src/modules/game.js index 5bc1fe3..e66f126 100644 --- a/src/modules/game.js +++ b/src/modules/game.js @@ -2,8 +2,6 @@ import * as firingArc from './game/firingArc.js'; import * as sightLine from './game/sightLine.js'; import * as counterMod from './game/counter.js'; -const svgns = "http://www.w3.org/2000/svg"; - function getCellContents(cell) { return cell.querySelectorAll('*:not(use[href="#hex"])'); } @@ -111,9 +109,7 @@ function drawSightLine(sourceCell, targetCell) { distanceCallback && distanceCallback(hexes.length - 1); } -let svg, distanceCallback, proneFlagCallback, selectCallback; - -let board, +let svg, distanceCallback, proneFlagCallback, selectCallback, placing = []; export function setDistanceCallback(callback) { @@ -130,7 +126,6 @@ export function setSelectCallback(callback) { export function start(el) { svg = el; - board = svg.querySelector('.board'); getCells(svg).forEach(cell => { cell.addEventListener('click', e => { @@ -332,16 +327,16 @@ export function toggleProne() { } } -export function toggleFiringArcVisibility(allegiance) { - firingArc.toggleVisibility(svg, allegiance); +export function toggleFiringArcVisibility() { + firingArc.toggleVisibility(svg, this.dataset.allegiance); } -export function setFiringArc(size) { +export function setFiringArc() { const counter = getSelected(), isOnBoard = counter => counter && counter.parentElement.hasAttribute('data-x'); if (isOnBoard(counter)) { - firingArc.set(svg, size, counter, getCellPosition(counter.parentElement)); + firingArc.set(svg, this.dataset.size, counter, getCellPosition(counter.parentElement)); } } |