From 080701df684bfe87b62dc54c857fefd9f3dc30ff Mon Sep 17 00:00:00 2001 From: iainp5 Date: Thu, 3 Oct 2024 23:14:05 +0100 Subject: Updates to reduce game object --- play.js | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index d7f9f75..cc703e9 100644 --- a/play.js +++ b/play.js @@ -15,7 +15,7 @@ const counters = document.getElementById('counters') const countries= ['Poland', 'Hungary', 'East_Germany', 'Bulgaria', 'Czechoslovakia', 'Romania'] -const aside_events = [ +/*const aside_events = [ "honecker", "st_nicholas_church", "helsinki_final_act", @@ -31,7 +31,9 @@ const aside_events = [ "stand_fast", "elena", "new_years_eve_party" -] +]*/ + +const aside_events = [ 2, 9, 15, 24, 26, 39, 48, 49, 53, 58, 59, 65, 69, 70, 73, 97, 100, 101, 104 ] let aside_events_showing = false let show_discard = false @@ -528,16 +530,13 @@ if (view.ceausescu_cards.length > 0 && view.is_pwr_struggle === true) { //console.log('valid spaces: ', view.valid_spaces) // UPDATE EVENT MARKERS - -for (let id in view.persistent_events) { - let marker = document.getElementById(id) - if (marker && view.persistent_events[id]) { - marker.style.display = 'block' - } else if (marker && !view.persistent_events[id]) { - marker.style.display = 'none' - } else if (marker && view.persistent_events[id] !== "") { +console.log('view.persistent_events', view.persistent_events) +for (let id of aside_events) { + let marker = document.getElementById(`event_${id}`) + console.log('event', id, marker) + if (view.persistent_events.includes(id)) { marker.style.display = 'block' - } else if(marker && view.persistent_events[id] === '') { + } else { marker.style.display = 'none' } } @@ -546,10 +545,10 @@ for (let id in view.persistent_events) { // CHECK WHETHER ANY EVENT MARKERS ARE SHOWING IN THE ASIDE aside_events_showing = false for (let id of aside_events) { - if (view.persistent_events[id]) { + if (view.persistent_events.includes(id)) { aside_events_showing = true; } - +/* //Special check for events which are not true/false if (view.persistent_events['foreign_currency_debt_burden'] !== '') { aside_events_showing = true @@ -557,6 +556,7 @@ for (let id of aside_events) { if (view.persistent_events['stand_fast'] !== '') { aside_events_showing = true } + */ } if (aside_events_showing) { @@ -565,16 +565,16 @@ if (aside_events_showing) { document.getElementById('events_panel').classList.add("hide") } -let systematization = document.getElementById('systematization') -if (view.persistent_events['systematization'] > 0) { - systematization.style.left = (spaces[view.persistent_events['systematization']].box.x +20) + 'px'; - systematization.style.top = spaces[view.persistent_events['systematization']].box.y + 'px'; +let systematization = document.getElementById('event_69') +if (view.persistent_events.includes(69)) { + systematization.style.left = (spaces[view.systematization].box.x +20) + 'px'; + systematization.style.top = spaces[view.systematization].box.y + 'px'; } -let tyrant = document.getElementById('the_tyrant_is_gone') -if (view.persistent_events['the_tyrant_is_gone'] > 0) { - tyrant.style.left = (spaces[view.persistent_events['the_tyrant_is_gone']].box.x - 41) + 'px'; - tyrant.style.top = (spaces[view.persistent_events['the_tyrant_is_gone']].box.y + 23) + 'px'; +let tyrant = document.getElementById('event_97') +if (view.persistent_events.includes(97)) { + tyrant.style.left = (spaces[view.the_tyrant_is_gone].box.x - 41) + 'px'; + tyrant.style.top = (spaces[view.the_tyrant_is_gone].box.y + 23) + 'px'; } else {tyrant.style.display = 'none'} action_button("yes", "Yes") -- cgit v1.2.3