ref: 6e79ff9df5cd3429e6b75a43d61d760cbbe00939
parent: b873c87c37695433f3830a92d79ca40e42d008a2
author: Simon Tatham <anakin@pobox.com>
date: Fri Jun 24 12:35:42 EDT 2005
Couple of presets. [originally from svn r6011]
--- a/guess.c
+++ b/guess.c
@@ -60,11 +60,6 @@
return ret;
}
-static int game_fetch_preset(int i, char **name, game_params **params)
-{
- return FALSE;
-}
-
static void free_params(game_params *params)
{
sfree(params);
@@ -75,6 +70,32 @@
game_params *ret = snew(game_params);
*ret = *params; /* structure copy */
return ret;
+}
+
+static const struct {
+ char *name;
+ game_params params;
+} guess_presets[] = {
+ {"Standard", {6, 4, 10, FALSE, TRUE}},
+ {"Super", {8, 5, 12, FALSE, TRUE}},
+};
+
+
+static int game_fetch_preset(int i, char **name, game_params **params)
+{
+ if (i < 0 || i >= lenof(guess_presets))
+ return FALSE;
+
+ *name = dupstr(guess_presets[i].name);
+ /*
+ * get round annoying const issues
+ */
+ {
+ game_params tmp = guess_presets[i].params;
+ *params = dup_params(&tmp);
+ }
+
+ return TRUE;
}
static void decode_params(game_params *params, char const *string)