diff options
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 28 |
1 files changed, 16 insertions, 12 deletions
@@ -632,18 +632,22 @@ function update_map() { ui.months[i].classList.toggle("now", i === view.month) } - for (let i = ui.minefields.length; i < view.minefields.length; ++i) { - let elt = ui.minefields[i] = document.createElement("div") - elt.className = "minefield" - ui.minefields_holder.appendChild(elt) - } - for (let i = view.minefields.length; i < ui.minefields.length; ++i) { - ui.minefields[i].remove() - } - for (let i = 0; i < view.minefields.length; ++i) { - let hex = view.minefields[i] - ui.minefields[i].style.left = (ui.hex_x[hex] - 40) + "px" - ui.minefields[i].style.top = (ui.hex_y[hex] + 4) + "px" + if (view.minefields) { + for (let i = ui.minefields.length; i < view.minefields.length; ++i) { + let elt = ui.minefields[i] = document.createElement("div") + elt.className = "minefield" + ui.minefields_holder.appendChild(elt) + } + for (let i = view.minefields.length; i < ui.minefields.length; ++i) + ui.minefields[i].remove() + for (let i = 0; i < view.minefields.length; ++i) { + let hex = view.minefields[i] + ui.minefields[i].style.left = (ui.hex_x[hex] - 40) + "px" + ui.minefields[i].style.top = (ui.hex_y[hex] + 4) + "px" + } + } else { + for (let i = 0; i < ui.minefields.length; ++i) + ui.minefields[i].remove() } for (let hex = 0; hex < stack.length; ++hex) { |