summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-10-30 12:12:29 +0100
committerTor Andersson <tor@ccxvii.net>2023-10-30 12:34:12 +0100
commitb3a8ffb3151ff6294a0126fe0b6468db830aeeba (patch)
tree4c2896731eeac4053948266461d0cb5dc42b16e4
parent274695921c2f33420aedfb11e1f3bdf382279cbc (diff)
downloadalgeria-b3a8ffb3151ff6294a0126fe0b6468db830aeeba.tar.gz
Change gen_action("foo") to accept actions sans arguments.
... without creating a one-element list containing a null.
-rw-r--r--rules.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/rules.js b/rules.js
index 26e240b..71c970f 100644
--- a/rules.js
+++ b/rules.js
@@ -984,9 +984,13 @@ exports.scenarios = [ "1954", "1958", "1960" ]
exports.roles = [ FLN_NAME, GOV_NAME ]
function gen_action(action, argument) {
- if (!(action in view.actions))
- view.actions[action] = []
- view.actions[action].push(argument)
+ if (argument === undefined) {
+ view.actions[action] = 1
+ } else {
+ if (!(action in view.actions))
+ view.actions[action] = []
+ view.actions[action].push(argument)
+ }
}
function gen_action_unit(u) {