From 2df3e79687f2fc4456d20030c5bfec98f37f2c08 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 3 Sep 2022 15:06:16 +0200 Subject: Give supply to all units in final supply check. --- rules.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/rules.js b/rules.js index 9672184..8d98a63 100644 --- a/rules.js +++ b/rules.js @@ -2535,10 +2535,10 @@ function union_allied_line() { const FORTRESS_HEX_LIST = [ BARDIA, BENGHAZI, TOBRUK ] const FORTRESS_SRC_LIST = [ SS_BARDIA, SS_BENGHAZI, SS_TOBRUK ] -function all_friendly_unsupplied_and_undisrupted_units() { +function all_friendly_unsupplied_units() { let result = [] for_each_friendly_unit_on_map(u => { - if (is_unit_undisrupted(u) && is_unit_unsupplied(u)) + if (is_unit_unsupplied(u)) result.push(u) }) return result @@ -2824,13 +2824,16 @@ function goto_final_supply_check() { game.raiders.length = 0 // Unsupplied and in danger of disruption! - game.disrupt = all_friendly_unsupplied_and_undisrupted_units() + game.disrupt = all_friendly_unsupplied_units() // Now in supply! let base_net = friendly_supply_network() for (let u of game.disrupt) { - if (base_net[unit_hex(u)]) + if (base_net[unit_hex(u)]) { + // TODO: summary? + log(`Restored supply at #${unit_hex(u)}.`) set_unit_supply(u, SS_BASE) + } } // Assign leftover fortress and oasis supply @@ -2841,7 +2844,7 @@ function goto_final_supply_check() { function goto_final_supply_check_disrupt() { for (let u of game.disrupt) { - if (!is_unit_supplied(u)) { + if (is_unit_unsupplied(u) && is_unit_undisrupted(u)) { log(`Disrupted at #${unit_hex(u)}`) set_unit_disrupted(u) } -- cgit v1.2.3