diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-03-27 03:02:50 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-02-18 11:54:52 +0100 |
commit | f2bae6c3bcddaeaca1f585421c67e99fdd57b68a (patch) | |
tree | 97593a7cb6f604fea4b554fec896aa962796ef3b | |
parent | 1ecaaa898e3519aa1046d49b37b1871a6397c809 (diff) | |
download | wilderness-war-f2bae6c3bcddaeaca1f585421c67e99fdd57b68a.tar.gz |
Fix unstacking while besieged.
-rw-r--r-- | rules.js | 20 |
1 files changed, 9 insertions, 11 deletions
@@ -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); |