index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/gameboard.js | 3 | ||||
-rw-r--r-- | src/modules/record_sheet.js | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/modules/gameboard.js b/src/modules/gameboard.js index a354795..38a9a9a 100644 --- a/src/modules/gameboard.js +++ b/src/modules/gameboard.js @@ -200,7 +200,8 @@ function endMove() { export function start(el) { svg = el; - getUnits(svg).forEach(unit => unit.addEventListener('click', selectOffBoard)); + const startingLocations = svg.querySelector('.start-locations'); + startingLocations && getUnits(startingLocations).forEach(unit => unit.addEventListener('click', selectOffBoard)); getCells(svg).forEach(cell => { cell.addEventListener('click', e => { diff --git a/src/modules/record_sheet.js b/src/modules/record_sheet.js index 61cea98..2865309 100644 --- a/src/modules/record_sheet.js +++ b/src/modules/record_sheet.js @@ -179,7 +179,7 @@ export function start(startLoc, units) { for (const affiliation in forces) { const container = document.querySelector(`#${affiliation}-record`); const records = container.querySelector('.records'); - const name = startLoc.dataset[`${affiliation}Name`]; + const name = startLoc?.dataset[`${affiliation}Name`]; if (name) { container.querySelector('.name').textContent = name; |