diff options
-rw-r--r-- | rules.js | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -1215,6 +1215,8 @@ function forward_supply_next_move_type(here_move, road) { function trace_supply_network_1(start) { + let search_order = [] + supply_net[start] = 1 supply_visited.fill(8) @@ -1226,6 +1228,9 @@ function trace_supply_network_1(start) let here = item >> 3 let here_move = item & 7 + if (supply_friendly[here] > 0) + search_order.unshift(here) + for (let s = 0; s < 6; ++s) { let next = here + hexnext[s] @@ -1259,6 +1264,8 @@ function trace_supply_network_1(start) queue.push((next << 3) | next_move) } } + + return search_order } // PASS 2: Filter net to only include supply lines used by units. @@ -1452,20 +1459,15 @@ function all_hexes_sorted_by_distance_to_base(x) { }) } -const all_hexes_for_axis_supply = all_hexes_sorted_by_distance_to_base(EL_AGHEILA) -const all_hexes_for_allied_supply = all_hexes_sorted_by_distance_to_base(ALEXANDRIA) - function trace_supply_network(start) { check_timeout() - let search_order = (start === EL_AGHEILA ? all_hexes_for_axis_supply : all_hexes_for_allied_supply) - supply_net.fill(0) supply_line.fill(0) // Pass 1: Find hexes that are in supply range. - trace_supply_network_1(start) + let search_order = trace_supply_network_1(start) // Pass 2: Filter hexes that have actual supply lines from units. supply_visited.fill(0) |