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-30 21:10:11 -0700 |
---|---|---|
committer | Catalin Mititiuc <webdevcat@proton.me> | 2024-04-30 21:22:00 -0700 |
commit | a3bf726e40fe4ed529bdefa83c977af4b72791a9 (patch) | |
tree | ab42c7cc50545a670ffd6b8804a769ec0b086b3f /src/modules/record_sheet.js | |
parent | 1eda0dafd539b6a259fe1ad4609419c8f04c49c7 (diff) |
Allow placing a counter that doesn't already exist
Diffstat (limited to 'src/modules/record_sheet.js')
-rw-r--r-- | src/modules/record_sheet.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/modules/record_sheet.js b/src/modules/record_sheet.js index 736ffb2..6909249 100644 --- a/src/modules/record_sheet.js +++ b/src/modules/record_sheet.js @@ -94,12 +94,17 @@ export function getSelected() { } export function select(data) { - const selector = - `#record-sheet .soldier-record[data-number="${data.number}"][data-allegiance="${data.allegiance}"]` - unSelect(); + + if (!data) { + return; + } + + const { allegiance: al, number: n } = data, + selector = `.soldier-record[data-number="${n}"][data-allegiance="${al}"]`; + document.querySelector(selector).classList.add('selected'); - document.getElementById('toggle-prone-counter').checked = data.prone; + document.querySelector('#toggle-prone-counter').checked = data.prone; } export function endMove() { |