diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-09-03 15:06:16 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-17 13:11:27 +0100 |
commit | 2df3e79687f2fc4456d20030c5bfec98f37f2c08 (patch) | |
tree | ce837626dd564f8e8f5daef47be1a9d435f8c700 | |
parent | c1b934d988f7e21d28ec0b84e2792e638fab2b31 (diff) | |
download | rommel-in-the-desert-2df3e79687f2fc4456d20030c5bfec98f37f2c08.tar.gz |
Give supply to all units in final supply check.
-rw-r--r-- | rules.js | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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) } |