From f2bae6c3bcddaeaca1f585421c67e99fdd57b68a Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 27 Mar 2022 03:02:50 +0200 Subject: Fix unstacking while besieged. --- rules.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/rules.js b/rules.js index 3fa84b3..3420c36 100644 --- a/rules.js +++ b/rules.js @@ -1686,10 +1686,15 @@ function place_friendly_fort_uc(s) { } // Isolate piece from any forces it may be involved in. -function unstack_force(p) { - let s = piece_space(p); - if (is_leader(p)) - move_pieces_from_node_to_node(leader_box(p), s); +function unstack_force(ldr) { + if (is_leader(ldr)) { + let box = leader_box(ldr); + let s = piece_space_and_inside(ldr); + for (let p = 1; p <= last_piece; ++p) { + if (piece_node(p) === box) + game.location[p] = s; + } + } } function unstack_piece_from_force(p) { @@ -1806,13 +1811,6 @@ function place_piece(who, to) { } } -function move_pieces_from_node_to_node(from, to) { - for (let p = 1; p <= last_piece; ++p) { - if (piece_node(p) === from) - move_piece_to(p, to); - } -} - function capture_enemy_fortress(s) { log(`Captured fortress at ${space_name(s)}.`); remove_from_array(enemy_player.fortresses, s); -- cgit v1.2.3