From 427167da7870d5eea6cf7196322cd5bb1e7c7b94 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 19 May 2024 01:51:18 +0200 Subject: bit flags --- play.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index eb86314..f4411ec 100644 --- a/play.js +++ b/play.js @@ -22,6 +22,10 @@ const BLOCKADE_ZONES = [ "Sea1", "Sea2", "Sea3", "Sea4", "Sea5", "Sea6", "Sea7" const P_BRITAIN = "Britain" const P_AMERICA = "America" +const F_REGULARS = 2 +const F_EUROPEAN_WAR = 4 +const F_MUTINIES = 16 + const space_count = 66 const general_count = data.generals.length @@ -266,7 +270,7 @@ function update_units() { const cuY = 10 update_marker(ui.turn, "Game Turn " + view.year) - if (view.regulars) + if (view.flags & F_REGULARS) ui.turn.classList.remove("no-regulars") else ui.turn.classList.add("no-regulars") @@ -274,7 +278,7 @@ function update_units() { update_marker(ui.congress, view.congress) update_marker(ui.french_alliance, "French Alliance Track " + view.french_alliance) - if (view.european_war) + if (view.flags & F_EUROPEAN_WAR) ui.french_alliance.classList.add("european-war") else ui.french_alliance.classList.remove("european-war") @@ -371,7 +375,7 @@ build_map() function player_info(player, nc, nq) { let info = "" if (player == P_AMERICA) { - if (view.pennsylvania_and_new_jersey_line_mutinies || view.congress === CONTINENTAL_CONGRESS_DISPERSED) + if ((view.flags & F_MUTINIES) || view.congress === CONTINENTAL_CONGRESS_DISPERSED) info += "\u{1f6ab} " } if (nq > 0) -- cgit v1.2.3