summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-12 20:50:14 +0100
committerTor Andersson <tor@ccxvii.net>2023-12-12 20:50:14 +0100
commit7f18725fedd24399652c0890a1b98a6354682b34 (patch)
treebc931526f01c2c789798940f6aef46bc87b5c66b
parentf9d52042ea56a64c9c5b1e18fa7a51fe049a0b0f (diff)
downloadandean-abyss-7f18725fedd24399652c0890a1b98a6354682b34.tar.gz
Don't allow removing the currently selected piece.
-rw-r--r--rules.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/rules.js b/rules.js
index ee140f8..f6ced70 100644
--- a/rules.js
+++ b/rules.js
@@ -1798,19 +1798,24 @@ states.remove_pieces = {
disable_negotiation: true,
prompt() {
view.prompt = "Remove pieces to Available Forces."
+ let who = -1
+ if (game.op)
+ who = game.op.who
+ else if (game.prop)
+ who = game.prop.who
for (let p = first_piece[game.current][BASE]; p <= last_piece[game.current][BASE]; ++p)
- if (piece_space(p) >= 0)
+ if (piece_space(p) >= 0 && p !== who)
gen_action_piece(p)
if (game.current === GOVT) {
for (let p = first_piece[game.current][TROOPS]; p <= last_piece[game.current][TROOPS]; ++p)
- if (piece_space(p) >= 0)
+ if (piece_space(p) >= 0 && p !== who)
gen_action_piece(p)
for (let p = first_piece[game.current][POLICE]; p <= last_piece[game.current][POLICE]; ++p)
- if (piece_space(p) >= 0)
+ if (piece_space(p) >= 0 && p !== who)
gen_action_piece(p)
} else {
for (let p = first_piece[game.current][GUERRILLA]; p <= last_piece[game.current][GUERRILLA]; ++p)
- if (piece_space(p) >= 0)
+ if (piece_space(p) >= 0 && p !== who)
gen_action_piece(p)
}
view.actions.done = 1