summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2025-02-12 16:22:45 +0100
committerTor Andersson <tor@ccxvii.net>2025-02-12 16:24:57 +0100
commitab2604ea91bb47663199026f71a0552ccd2ad05a (patch)
tree5d3657984ab2917e23f416579dbce967f45ea60d
parentd47697e08d02fa0b955c4be6c734fd5d10a95e6b (diff)
downloadmaria-ab2604ea91bb47663199026f71a0552ccd2ad05a.tar.gz
Fix retroactive victory marker display.HEADmaster
only take out of the pool the retroactive markers that would be placed, not the ones that would be removed!
-rw-r--r--play.js19
1 files changed, 14 insertions, 5 deletions
diff --git a/play.js b/play.js
index e102523..a954e2d 100644
--- a/play.js
+++ b/play.js
@@ -1232,6 +1232,7 @@ function elector_majority() {
function count_victory_markers(pow) {
let n = view.vp[pow]
+
if (pow === P_PRUSSIA) {
n += view.vp[SET_ASIDE_PRUSSIA]
if (view.flags & F_SILESIA_ANNEXED) ++n
@@ -1253,11 +1254,19 @@ function count_victory_markers(pow) {
if (view.victory[i+1] === pow)
++n
- // count retroactive markers for display (except 4 special electoral colleges)
- for (let i = 0; i < view.retro.length; i += 2)
- if (!set_has(all_elector_fortresses, view.retro[i]))
- if (actual_retro_power(view.retro[i], view.retro[i+1]) === pow)
- ++n
+ // count retroactive markers for display
+ map_for_each(view.retro, (s, retro_pow) => {
+ // ignore 4 special electoral colleges (these markers do not affect the pool)
+ if (set_has(all_elector_fortresses, s))
+ return
+
+ let old_pow = map_get(view.victory, s, -1)
+ let new_pow = actual_retro_power(s, retro_pow)
+
+ // only count markers that would be put out (not those that would be removed)
+ if (new_pow === pow && new_pow !== old_pow)
+ ++n
+ })
return n
}