From fd3f5c5ae56793b7a9ded795720864e2ecbbba9b Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 25 May 2024 19:08:28 +0200 Subject: fix supply train breakage in previous commit --- play.js | 2 ++ rules.js | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/play.js b/play.js index f2dc0a2..51a2b73 100644 --- a/play.js +++ b/play.js @@ -3,6 +3,8 @@ // vim: set nowrap: // TODO: sort selected generals above deselected generals when detaching? +// TODO: show battle icon overlay (instead of roads) +// TODO: remove roads and path highlighting code const svgNS = "http://www.w3.org/2000/svg" diff --git a/rules.js b/rules.js index 701044e..f0b082d 100644 --- a/rules.js +++ b/rules.js @@ -1352,11 +1352,16 @@ states.movement = { piece(p) { push_undo() - game.selected = [] let here = game.pos[p] - for (let other of all_power_generals[game.power]) - if (other >= p && game.pos[other] === here && !set_has(game.moved, other)) - game.selected.push(other) + + if (is_general(p)) { + game.selected = [] + for (let other of all_power_generals[game.power]) + if (other >= p && game.pos[other] === here && !set_has(game.moved, other)) + game.selected.push(other) + } else { + game.selected = [ p ] + } game.count = 0 -- cgit v1.2.3