summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2025-03-23 00:12:56 +0100
committerTor Andersson <tor@ccxvii.net>2025-03-23 00:13:13 +0100
commit3207789c844dd48f4647e8fa7693d35d6559927e (patch)
tree7da4b14d78198b3ecea3ed7322931487187a1253
parenta3b0f2f2f06b35eebe52016977c3dbd2870673ad (diff)
downloadland-and-freedom-3207789c844dd48f4647e8fa7693d35d6559927e.tar.gz
Add paranoid safeguard against impossible case.
-rw-r--r--rules.js6
-rw-r--r--rules.ts6
2 files changed, 10 insertions, 2 deletions
diff --git a/rules.js b/rules.js
index 078024f..a93cde7 100644
--- a/rules.js
+++ b/rules.js
@@ -163,7 +163,11 @@ function setup_player_turn(faction_id) {
next();
}
else {
- setup_player_turn(get_next_faction_in_player_order(next_faction));
+ const next_next_faction = get_next_faction_in_player_order(next_faction);
+ if (game.selected_cards[next_next_faction].length > 0)
+ setup_player_turn(get_next_faction_in_player_order(next_next_faction));
+ else
+ throw new Error("impossible situation");
}
}
function check_end_of_year_discard() {
diff --git a/rules.ts b/rules.ts
index d4ca3d6..e5fa8bd 100644
--- a/rules.ts
+++ b/rules.ts
@@ -288,7 +288,11 @@ function setup_player_turn(faction_id: FactionId) {
* having played Momentum medallion in a previous turn.
* This will skip their turn
*/
- setup_player_turn(get_next_faction_in_player_order(next_faction))
+ const next_next_faction = get_next_faction_in_player_order(next_faction);
+ if (game.selected_cards[next_next_faction].length > 0)
+ setup_player_turn(get_next_faction_in_player_order(next_next_faction));
+ else
+ throw new Error("impossible situation");
}
}