diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-08-28 23:29:50 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-17 13:11:26 +0100 |
commit | ce4898ae41817f990013c6bf22d081e87dde1ed7 (patch) | |
tree | 67477897b743b6ed4baec88de499865bb7bc3eae /rules.js | |
parent | 0ffda67c0726e8906fba200c2a1fb586ed09f0d6 (diff) | |
download | rommel-in-the-desert-ce4898ae41817f990013c6bf22d081e87dde1ed7.tar.gz |
Remove bad supply source optimization.
Supply lines can't loop around through itself. We added extra supply
sources when we found a highway or head of chain hex in supply, which
could (incorrectly) be used as a supply source for a loop further ahead.
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 19 |
1 files changed, 6 insertions, 13 deletions
@@ -1227,11 +1227,8 @@ function trace_supply_highway(here, d) { supply_visited[here] = 0 - if (has_supply) { + if (has_supply) supply_net[here] = 1 - if (supply_enemy[here] <= 1) - supply_src[here] = 1 - } return has_supply } @@ -1321,17 +1318,13 @@ function trace_supply_chain(here, d, n, range) { supply_visited[here] = 0 - if (has_supply) { + if (has_supply) supply_net[here] = 1 - // undisrupted units can chain supply - if (supply_friendly[here] > 1 && supply_enemy[here] <= 1) - supply_src[here] = 1 - } return has_supply } -function trace_supply_network(start, ss) { +function trace_supply_network(start) { supply_visited.fill(0) supply_src.fill(0) supply_net.fill(0) @@ -1408,13 +1401,13 @@ function can_trace_supply_to_base_or_fortress(base, from) { function update_axis_supply() { supply_axis_invalid = false init_trace_supply(supply_axis_network, supply_axis_line, AXIS) - trace_supply_network(EL_AGHEILA, 0) + trace_supply_network(EL_AGHEILA) } function update_allied_supply() { supply_allied_invalid = false init_trace_supply(supply_allied_network, supply_allied_line, ALLIED) - trace_supply_network(ALEXANDRIA, 0) + trace_supply_network(ALEXANDRIA) } function update_bardia_supply() { @@ -1496,7 +1489,7 @@ function tobruk_supply_network() { } function unit_supply_line(who) { - // override with saved supply line during withdrawal regroup moves + // Use saved supply line during withdrawal regroup moves. if (is_active_player() && game.withdraw && game.withdraw.supply_line) { switch (unit_supply(who)) { case SS_BARDIA: return game.withdraw.bardia_line |