From 57b4a5c0e7c59dca360c5e5abd7275abec1008c8 Mon Sep 17 00:00:00 2001
From: Tor Andersson <tor@ccxvii.net>
Date: Sun, 7 Nov 2021 18:47:37 +0100
Subject: Add options to game setup.

---
 create.html | 10 ++++++----
 rules.js    |  7 +++----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/create.html b/create.html
index 2c12a31..599bf88 100644
--- a/create.html
+++ b/create.html
@@ -4,12 +4,14 @@
 <dd>
 Historical deployment.
 <dt>
-Tournament:
-<dd>
-Historical deployment, but Julius Caesar goes first on the first turn regardless of the cards played.
-<dt>
 <a href="/julius-caesar/info/rules.html#setup">Free Deployment</a>:
 <dd>
 Players may swap any blocks on the map as long as the original number of
 deployed blocks in each city is maintained.
 </dl>
+
+Optional rules:
+<p>
+<label><input type="checkbox" name="tournament" value="true">
+Tournament &#x2014; Julius Caesar goes first on the first turn regardless of the cards played.
+</label>
diff --git a/rules.js b/rules.js
index 342349c..93b1611 100644
--- a/rules.js
+++ b/rules.js
@@ -2,7 +2,6 @@
 
 exports.scenarios = [
 	"Historical",
-	"Tournament",
 	"Free Deployment",
 	// TODO: Avalon Digital scenarios?
 ];
@@ -2376,14 +2375,14 @@ states.game_over = {
 	},
 }
 
-exports.ready = function (scenario, players) {
+exports.ready = function (scenario, options, players) {
 	return players.length === 2;
 }
 
-exports.setup = function (seed, scenario) {
+exports.setup = function (seed, scenario, options) {
 	game = {
 		seed: seed,
-		tournament: (scenario === "Tournament"),
+		tournament: options.tournament ? 1 : 0,
 		c_hand: [],
 		p_hand: [],
 		c_card: 0,
-- 
cgit v1.2.3