From ed3fbab5440ea95bf04d10880f178681a379ff5b Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 15 Sep 2022 23:30:02 +0200 Subject: Fix movement summary flushing and reinitializing between overruns. --- rules.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/rules.js b/rules.js index a7f28fe..31e5a6c 100644 --- a/rules.js +++ b/rules.js @@ -2862,16 +2862,16 @@ function save_withdrawal_supply_lines() { // ==== MOVEMENT PHASE === -function init_move_summary() { - game.summary = {} -} - function push_move_summary(from, to, via, forced) { let mm = (from) | (to << 8) | (via << 16) | (forced << 24) + if (game.summary === null) + game.summary = {} game.summary[mm] = (game.summary[mm]|0) + 1 } function flush_move_summary() { + if (game.summary === null) + return log_br() if (!game.from1 && !game.from2) { log(`Passed.`) @@ -2925,7 +2925,6 @@ function goto_move_phase() { set_clear(game.fired) game.forced = [] game.state = 'select_moves' - init_move_summary() if (game.phasing === AXIS && game.scenario !== "1940" && game.rommel === 0) if (game.turn_option !== 'offensive' && game.turn_option !== 'blitz') @@ -3421,7 +3420,6 @@ states.move = { overrun() { push_undo() flush_move_summary() - init_move_summary() game.state = 'overrun' if (false) { -- cgit v1.2.3