diff options
author | iainp5 <iain.pearce.ip@gmail.com> | 2024-12-15 21:50:03 +0000 |
---|---|---|
committer | iainp5 <iain.pearce.ip@gmail.com> | 2024-12-15 21:50:03 +0000 |
commit | 0a6ddacdb1758e49c305c280f8c59a9580c41d08 (patch) | |
tree | 75b9ebcc9625319496f2fe999faa9471a54ab883 | |
parent | e95b074cf8e3f2595d24bff3c7071aa0c6aa705f (diff) | |
download | 1989-dawn-of-freedom-0a6ddacdb1758e49c305c280f8c59a9580c41d08.tar.gz |
Update logging of Genscher
-rw-r--r-- | rules.js | 68 |
1 files changed, 38 insertions, 30 deletions
@@ -4512,40 +4512,48 @@ function pop_summary_i() { game.summary = [] } */ - function pop_summary_i() { - if (game.summary.length > 0) { - // Create a map to group by space and track totals and details - let grouped_summary = new Map(); - - for (let [n, msg] of game.summary) { - // Extract the space identifier (e.g., %67) from the message - let space_match = msg.match(/%\d+/); - let space = space_match ? space_match[0] : "unknown"; - - // Extract any details (e.g., £CU to £CC) from the message - let details_match = msg.match(/\(.*?\)$/); - let details = details_match ? details_match[0] : ""; - - // Update or initialize the entry for the space - if (!grouped_summary.has(space)) { - grouped_summary.set(space, { total: 0, details }); - } - let entry = grouped_summary.get(space); - entry.total += n; - - // Always keep the most specific details (non-empty) - if (details) { - entry.details = details; - } +function pop_summary_i() { + if (game.summary.length > 0) { + // Create a map to group by space and track totals and details + let grouped_summary = new Map(); + let c63_logged = false; + + for (let [n, msg] of game.summary) { + if (msg === "-1 op due to C63") { + if (!c63_logged) { + logi(msg); + c63_logged = true; + } + continue; + } + // Extract the space identifier (e.g., %67) from the message + let space_match = msg.match(/%\d+/); + let space = space_match ? space_match[0] : "unknown"; + + // Extract any details (e.g., £CU to £CC) from the message + let details_match = msg.match(/\(.*?\)$/); + let details = details_match ? details_match[0] : ""; + + // Update or initialize the entry for the space + if (!grouped_summary.has(space)) { + grouped_summary.set(space, { total: 0, details }); } - - // Log the grouped results - for (let [space, { total, details }] of grouped_summary) { - logi(`${total} in ${space} ${details}`); + let entry = grouped_summary.get(space); + entry.total += n; + + // Always keep the most specific details (non-empty) + if (details) { + entry.details = details; } } - game.summary = []; + + // Log the grouped results + for (let [space, { total, details }] of grouped_summary) { + logi(`${total} in ${space} ${details}`); + } } + game.summary = []; +} |