diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-01-21 21:12:26 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-01-21 21:12:26 +0100 |
commit | 7ee88861864e35f894bd45877a7f997715193252 (patch) | |
tree | fe0c5db4ea4f024612cb9ac4eb97f37f7528099c | |
parent | eb75ac62d218446117faa2bbbb93c48a7520d270 (diff) | |
download | wilderness-war-7ee88861864e35f894bd45877a7f997715193252.tar.gz |
Fix bug when recapturing fortress with leader captured inside.
-rw-r--r-- | rules.js | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -1864,6 +1864,7 @@ function capture_enemy_fortress(s) { function recapture_french_fortress(s) { log(`France recaptured fortress at %${s}.`) + set_all_pieces_outside(s) set_delete(game.british.fortresses, s) set_add(game.french.fortresses, s) award_french_vp(3) @@ -1871,6 +1872,7 @@ function recapture_french_fortress(s) { function recapture_british_fortress(s) { log(`Britain recaptured fortress at %${s}.`) + set_all_pieces_outside(s) set_delete(game.french.fortresses, s) set_add(game.british.fortresses, s) award_british_vp(3) @@ -1921,14 +1923,18 @@ function is_fort_or_fortress_vacant_of_besieging_units(s) { return !has_french_units(s) } +function set_all_pieces_outside(s) { + for (let p = 1; p <= last_piece; ++p) + if (is_piece_in_space(p, s)) + set_piece_outside(p) +} + function lift_sieges_and_amphib() { // Lift sieges for_each_siege(s => { if (is_fort_or_fortress_vacant_of_besieging_units(s)) { log(`Lifted siege at %${s}.`) - for (let p = 1; p <= last_piece; ++p) - if (is_piece_in_space(p, s)) - set_piece_outside(p) + set_all_pieces_outside(s) delete game.sieges[s] } }) |