diff options
-rw-r--r-- | rules.js | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -1622,15 +1622,19 @@ function search_redeploy(start) { // Breadth First Search function search_path_bfs(from, cost, start, road, max_cost, retreat, sline, sdist) { let path_enemy, enemy_sides + let exit1, exit2 if (presence_invalid) update_presence() if (is_axis_player()) { path_enemy = presence_allied enemy_sides = game.allied_sides + exit1 = exit2 = 175 } else { path_enemy = presence_axis enemy_sides = game.axis_sides + exit1 = 99 + exit2 = 148 } from.fill(0) @@ -1655,6 +1659,10 @@ function search_path_bfs(from, cost, start, road, max_cost, retreat, sline, sdis if (next < first_hex || next > last_hex || !hex_exists[next]) continue + // can't enter own map edge + if (next === exit1 || next === exit2) + continue + // already seen if (cost[next] < 15) continue @@ -1718,6 +1726,7 @@ function search_path_bfs(from, cost, start, road, max_cost, retreat, sline, sdis function search_path_redeploy_bfs(cost, start, road) { let path_enemy, friendly_network, enemy_network, enemy_sides + let exit1, exit2 if (presence_invalid) update_presence() @@ -1726,11 +1735,14 @@ function search_path_redeploy_bfs(cost, start, road) { friendly_network = game.buildup.axis_network enemy_network = game.buildup.allied_network enemy_sides = game.allied_sides + exit1 = exit2 = 175 } else { path_enemy = presence_axis friendly_network = game.buildup.allied_network enemy_network = game.buildup.axis_network enemy_sides = game.axis_sides + exit1 = 99 + exit2 = 148 } cost.fill(63) @@ -1754,6 +1766,10 @@ function search_path_redeploy_bfs(cost, start, road) { if (next < first_hex || next > last_hex || !hex_exists[next]) continue + // can't enter own map edge + if (next === exit1 || next === exit2) + continue + // already seen if (cost[next] < 63) continue |