Make the keyboard-control cursors visible whenever a keyboard control is
[sgt/puzzles] / guess.c
diff --git a/guess.c b/guess.c
index 35cfb5b..702a1ad 100644 (file)
--- a/guess.c
+++ b/guess.c
@@ -60,11 +60,6 @@ static game_params *default_params(void)
     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);
@@ -77,6 +72,32 @@ static game_params *dup_params(game_params *params)
     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)
 {
     char const *p = string;
@@ -679,6 +700,7 @@ static game_state *make_move(game_state *from, game_ui *ui, game_drawstate *ds,
         ret = from;
     } else if (button == CURSOR_SELECT || button == ' ' || button == '\r' ||
                button == '\n') {
+        ui->display_cur = 1;
         if (ui->peg_cur == from->params.npegs) {
             ret = mark_move(from, ui);
         } else {
@@ -686,6 +708,7 @@ static game_state *make_move(game_state *from, game_ui *ui, game_drawstate *ds,
             ret = from;
         }
     } else if (button == 'H' || button == 'h') {
+        ui->display_cur = 1;
         ui->holds[ui->peg_cur] = 1 - ui->holds[ui->peg_cur];
         ret = from;
     }