summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play.js32
-rw-r--r--rules.js1
2 files changed, 32 insertions, 1 deletions
diff --git a/play.js b/play.js
index d77ba24..99865f0 100644
--- a/play.js
+++ b/play.js
@@ -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 = []
diff --git a/rules.js b/rules.js
index 982081c..cd2b53e 100644
--- a/rules.js
+++ b/rules.js
@@ -1,6 +1,7 @@
"use strict"
// TODO: retreat withdraw co-exist with disrupted enemy - no hexside limits or control
+// TODO: force withdrawal of mandatory combat during pass turn (only show end turn if not possible)
// TODO: rout during probe combat?
// TODO: allow one-hex regroup moves? (failed forced march abuse)