diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-07-30 22:00:50 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-17 13:11:26 +0100 |
commit | d109a4fa1d646c7f1066d86e5f1ca01ce9bc00cc (patch) | |
tree | 0c916d10d6229e08f0cdce34a8b25e4ef16fbf2f | |
parent | e8ee549f0d30c5caa99b2d931734c5f18332d543 (diff) | |
download | rommel-in-the-desert-d109a4fa1d646c7f1066d86e5f1ca01ce9bc00cc.tar.gz |
Fix awkward selection/undo during buildup.
-rw-r--r-- | rules.js | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -4677,9 +4677,16 @@ states.spending_bps = { gen_action('end_buildup') }, unit(who) { - if (game.selected < 0) + if (game.selected < 0) { push_undo() - apply_select(who) + game.selected = who + game.changed = 0 + } else { + if (!game.changed) + pop_undo() + else + game.selected = -1 + } }, extra_supply_card() { push_undo() @@ -4691,16 +4698,19 @@ states.spending_bps = { game.state = 'minefield' }, replacement() { + game.changed = 1 log(`Replaced unit.`) replace_unit(game.selected) pay_bps(replacement_cost(game.selected)) }, refit() { + game.changed = 1 log(`Returned for Refit.`) hide_unit(game.selected) set_unit_hex(pop_selected(), friendly_refit()) }, hex(to) { + game.changed = 1 let who = game.selected let from = unit_hex(who) if (to === from) { @@ -4732,6 +4742,7 @@ states.spending_bps = { } }, end_buildup() { + delete game.changed clear_undo() let n = available_bps() |