summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
Diffstat (limited to 'play.js')
-rw-r--r--play.js26
1 files changed, 11 insertions, 15 deletions
diff --git a/play.js b/play.js
index af7c57a..90eebb2 100644
--- a/play.js
+++ b/play.js
@@ -13,15 +13,7 @@ const toolbar = document.getElementById('toolbar')
const vpMarker = document.getElementById('vp')
const counters = document.getElementById('counters')
-const countries= [
- null,
- "East_Germany",
- "Poland",
- "Czechoslovakia",
- "Hungary",
- "Romania",
- "Bulgaria"
-]
+const countries= ['Poland', 'Hungary', 'East_Germany', 'Bulgaria', 'Czechoslovakia', 'Romania']
const aside_events = [
"honecker",
@@ -355,21 +347,21 @@ function on_update() {
}
// UPDATE COUNTRY MARKERS
- for (let i = 1; i < countries.length; i++) {
+ for (let i = 0; i < countries.length; i++) {
const country = countries[i];
const marker = document.getElementById(country)
const times_held = document.getElementById(`${country}_times_held`)
-
- if (view.revolutions[country]) {
+
+ if (view.revolutions[find_country_index(country)]) {
marker.classList.add('revolution')
marker.classList.remove('held')
marker.style.display = 'block'
times_held.classList.add('outlined_text')
- } else if (view.times_held[country] > 0 ) {
+ } else if (view.times_held[find_country_index(country)] > 0 ) {
//console.log('setting ', country)
marker.classList.add('held')
marker.style.display = 'block'
- times_held.innerHTML = view.times_held[country]
+ times_held.innerHTML = view.times_held[find_country_index(country)]
}
else {marker.style.display = 'none'}
}
@@ -621,7 +613,7 @@ if (view.persistent_events['the_tyrant_is_gone'] > 0) {
action_button("done", "Done")
action_button("undo", "Undo")
-console.log('view.persistent_events', view.persistent_events)
+console.log('view.revolutions', view.revolutions)
}
// =========================== LOG FUNCTIONS ==============================================
@@ -703,4 +695,8 @@ function check_com_control(demInfl, comInfl, space) {
} else{ false}
}
+function find_country_index(country) {
+ return countries.indexOf(country)
+}
+
create_ui()