From 098b4694a5247c304407b8e7e1a113c7809ba1ba Mon Sep 17 00:00:00 2001 From: iainp5 Date: Fri, 4 Oct 2024 10:46:20 +0100 Subject: Updates to reduce game object --- play.js | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index cc703e9..2b8741c 100644 --- a/play.js +++ b/play.js @@ -32,9 +32,9 @@ const countries= ['Poland', 'Hungary', 'East_Germany', 'Bulgaria', 'Czechoslovak "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 +const board_events = [2, 9, 69, 97] +const box_events = [ 15, 24, 26, 39, 48, 49, 53, 58, 59, 65, 70, 73, 100, 101, 104 ] +let box_events_showing = false let show_discard = false const overlay = document.getElementById('overlay'); @@ -529,9 +529,24 @@ if (view.ceausescu_cards.length > 0 && view.is_pwr_struggle === true) { //console.log('strategy discard: ', view.strategy_discard) //console.log('valid spaces: ', view.valid_spaces) -// UPDATE EVENT MARKERS -console.log('view.persistent_events', view.persistent_events) -for (let id of aside_events) { +//console.log('view.persistent_events', view.persistent_events) + +// UPDATE EVENT MARKERS ON THE BOARD + +for (let id of board_events) { + let marker = document.getElementById(`event_${id}`) + console.log('event', id, marker) + if (view.persistent_events.includes(id)) { + marker.style.display = 'block' + } else { + marker.style.display = 'none' + } +} + + +// UPDATE EVENT MARKERS BELOW THE BOARD + +for (let id of box_events) { let marker = document.getElementById(`event_${id}`) console.log('event', id, marker) if (view.persistent_events.includes(id)) { @@ -542,11 +557,11 @@ for (let id of aside_events) { } -// CHECK WHETHER ANY EVENT MARKERS ARE SHOWING IN THE ASIDE -aside_events_showing = false -for (let id of aside_events) { +// CHECK WHETHER ANY EVENT MARKERS ARE SHOWING IN THE EVENTS BOX +box_events_showing = false +for (let id of box_events) { if (view.persistent_events.includes(id)) { - aside_events_showing = true; + box_events_showing = true; } /* //Special check for events which are not true/false @@ -559,7 +574,7 @@ for (let id of aside_events) { */ } -if (aside_events_showing) { +if (box_events_showing) { document.getElementById('events_panel').classList.remove("hide") } else { document.getElementById('events_panel').classList.add("hide") @@ -620,7 +635,7 @@ if (view.persistent_events.includes(97)) { action_button("done", "Done") action_button("undo", "Undo") -console.log('view.revolutions', view.revolutions) +//console.log('view.revolutions', view.revolutions) } // =========================== LOG FUNCTIONS ============================================== -- cgit v1.2.3