diff options
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 32 |
1 files changed, 31 insertions, 1 deletions
@@ -15,6 +15,10 @@ const unit_count = 94 const EXIT_HEXES = [ 99, 148, 197 ] // [ 99, 123, 148 ] //, 172, 197 ] const REFIT_HEXES = [ 48, 102 ] +const BENGHAZI = 54 +const TOBRUK = 37 +const BARDIA = 40 + const SS_NONE = 0 const SS_BASE = 1 const SS_BARDIA = 2 @@ -47,6 +51,17 @@ function is_mechanized_unit(u) { return unit_speed[u] === 3 } function is_motorized_unit(u) { return unit_speed[u] === 2 } function is_leg_unit(u) { return unit_speed[u] === 1 } +function fortress_bit(fortress) { + if (fortress === BARDIA) return 1 + if (fortress === BENGHAZI) return 2 + if (fortress === TOBRUK) return 4 + return 0 +} + +function is_fortress_axis_controlled(fortress) { + return (view.fortress & fortress_bit(fortress)) === 0 +} + function set_has(set, item) { if (!set) return false @@ -330,7 +345,22 @@ function for_each_side_in_path(path, fn) { } function on_focus_hex(evt) { - document.getElementById("status").textContent = hex_name[evt.target.hex] + let hex = evt.target.hex + let text = hex_name[hex] + if (view) { + if (hex === BARDIA || hex === BENGHAZI || hex === TOBRUK) { + if (is_fortress_axis_controlled(hex)) + text += " - Axis control" + else + text += " - Allied control" + } else { + if (is_hex_axis_controlled(hex)) + text += " - Axis control" + if (is_hex_allied_controlled(hex)) + text += " - Allied control" + } + } + document.getElementById("status").textContent = text } const unit_description = [] |