diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-10-01 13:46:28 +0100 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-10-01 13:46:28 +0100 |
commit | 8379a9f203f7947f70cfaaa2452bd487569b1955 (patch) | |
tree | 9884331396e22a92c4aa41615580d48bcb8c3b8c /play.js | |
parent | b894db6ba236e18018fbc76571bff56972386ef9 (diff) | |
download | 1989-dawn-of-freedom-8379a9f203f7947f70cfaaa2452bd487569b1955.tar.gz |
Added game.summary, reduced game object
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 26 |
1 files changed, 11 insertions, 15 deletions
@@ -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()
|