summaryrefslogtreecommitdiff
path: root/rules.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-09-03 15:06:16 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 13:11:27 +0100
commit2df3e79687f2fc4456d20030c5bfec98f37f2c08 (patch)
treece837626dd564f8e8f5daef47be1a9d435f8c700 /rules.js
parentc1b934d988f7e21d28ec0b84e2792e638fab2b31 (diff)
downloadrommel-in-the-desert-2df3e79687f2fc4456d20030c5bfec98f37f2c08.tar.gz
Give supply to all units in final supply check.
Diffstat (limited to 'rules.js')
-rw-r--r--rules.js13
1 files 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)
}