diff options
Diffstat (limited to 'rules.js')
-rw-r--r-- | rules.js | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1142,7 +1142,7 @@ function shuffle_cards() { var supply_friendly_hexes, supply_friendly_sides, supply_friendly, supply_enemy, supply_net, supply_line var supply_visited = new Array(hexcount).fill(0) -var supply_memo = new Array(hexcount * 8).fill(0) +var supply_memo = new Array(hexcount * 8 * 6).fill(0) // PASS 1: Forward scan from source to compute potential supply net and valid hex side crossings. // Simple uniform cost search. @@ -1333,8 +1333,8 @@ function backward_supply_next_move_type(here_move, road) { return BACK_ABORT } -function trace_unit_supply_line(path, here, here_move, ssrc) { - let memo_idx = (here << 3) + here_move +function trace_unit_supply_line(path, here, here_move, ssrc, from_dir) { + let memo_idx = here * 48 + here_move * 6 + from_dir if (supply_memo[memo_idx]) { for (let x of path) supply_line[x] = 2 @@ -1419,7 +1419,7 @@ function trace_unit_supply_line(path, here, here_move, ssrc) { next_move = BACK_HIGHWAY_3 path.push(side) - if (trace_unit_supply_line(path, next, next_move, ssrc)) + if (trace_unit_supply_line(path, next, next_move, ssrc, s)) supplied = true path.pop() } @@ -1478,7 +1478,7 @@ function trace_supply_network(start) { let path = [] for (let x of search_order) { if (supply_friendly[x] > 0 && x !== start) { - trace_unit_supply_line(path, x, BACK_HEAD, start) + trace_unit_supply_line(path, x, BACK_HEAD, start, 0) } } @@ -1507,7 +1507,7 @@ function trace_fortress_network(fortress, ss) { let x = unit_hex(u) if (is_map_hex(x) && x !== fortress) { //if (supply_friendly[x] > 1 && supply_net[x]) continue - trace_unit_supply_line(path, x, BACK_HEAD, fortress) + trace_unit_supply_line(path, x, BACK_HEAD, fortress, 0) } } } |