summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
Diffstat (limited to 'play.js')
-rw-r--r--play.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/play.js b/play.js
index 18dc97c..ddb552c 100644
--- a/play.js
+++ b/play.js
@@ -603,7 +603,7 @@ function build_hexes() {
function build_units() {
function build_unit(u) {
- let nationality = is_german_unit(u) ? "german" : is_italian_unit(u) ? "italian" : "allied"
+ let nationality = is_axis_unit(u) ? "axis" : "allied"
let elt = ui.units[u] = document.createElement("div")
elt.className = `unit ${nationality} u${u} r0 m`
elt.addEventListener("mousedown", on_click_unit)
@@ -700,12 +700,16 @@ function layout_stack(stack, hex, start_x, start_y, wrap, xdir) {
e.classList.toggle("r2", r === 2)
e.classList.toggle("r3", r === 3)
e.classList.toggle("revealed", true)
+ if (is_italian_unit(u))
+ e.classList.toggle("italian", true)
} else {
e.classList.toggle("r0", false)
e.classList.toggle("r1", false)
e.classList.toggle("r2", false)
e.classList.toggle("r3", false)
e.classList.toggle("revealed", false)
+ if (is_italian_unit(u))
+ e.classList.toggle("italian", false)
}
e.classList.toggle("action", !view.battle && is_unit_action(u))
@@ -814,18 +818,20 @@ function update_map() {
let shared = (stack_list[hex][0].length > 0) && (stack_list[hex][1].length > 0)
for (let aa = 0; aa < 2; ++aa) {
+ let this_y = start_y
if (stack_list[hex][aa] === ui.focus) {
let height = Math.min(wrap, stack_list[hex][aa].length) * 56
- if (start_y + height + 25 > 960)
- start_y = 960 - height + 25
+ console.log("stack", hex, aa, wrap, stack_list[hex][aa].length, height, this_y + height + 25)
+ if (this_y + height + 25 > 960)
+ this_y = 960 - height - 25
}
if (shared) {
if (aa === 0)
- layout_stack(stack_list[hex][aa], hex, start_x - 28, start_y + 2, wrap, -1)
+ layout_stack(stack_list[hex][aa], hex, start_x - 28, this_y + 2, wrap, -1)
else
- layout_stack(stack_list[hex][aa], hex, start_x + 28, start_y - 2, wrap, 1)
+ layout_stack(stack_list[hex][aa], hex, start_x + 28, this_y - 2, wrap, 1)
} else {
- layout_stack(stack_list[hex][aa], hex, start_x, start_y, wrap, 1)
+ layout_stack(stack_list[hex][aa], hex, start_x, this_y, wrap, 1)
}
}