diff options
-rw-r--r-- | rules.js | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1956,13 +1956,15 @@ function unit_has_supply_line(who) { function can_unit_withdraw(who) { let result = false if (unit_has_supply_line(who)) { + let ssrc = unit_supply_source(who) let sline = unit_supply_line(who) let sdist = unit_supply_distance(who) let from = unit_hex(who) + search_own_supply_line(from, ssrc, sline, sdist) for_each_adjacent_hex(from, to => { let side = to_side_id(from, to) if (side_limit[side] > 0 && !has_enemy_unit(to)) - if (sline[side] && sdist[to] <= sdist[from]) + if (own_supply_line[side] && sdist[to] <= sdist[from]) result = true }) } @@ -1972,13 +1974,15 @@ function can_unit_withdraw(who) { function can_unit_disengage_and_withdraw(who) { let result = false if (unit_has_supply_line(who)) { + let ssrc = unit_supply_source(who) let sline = unit_supply_line(who) let sdist = unit_supply_distance(who) let from = unit_hex(who) + search_own_supply_line(from, ssrc, sline, sdist) for_each_adjacent_hex(from, to => { let side = to_side_id(from, to) if (side_limit[side] > 0 && !is_enemy_hexside(side) && !has_undisrupted_enemy_unit(to)) - if (sline[side] && sdist[to] <= sdist[from]) + if (own_supply_line[side] && sdist[to] <= sdist[from]) result = true }) } |