From 0d9c17e385e6b73b4669c08f8b86dc7b3b116683 Mon Sep 17 00:00:00 2001 From: girst Date: Tue, 12 Feb 2019 20:41:10 +0100 Subject: [PATCH] `:help` to show keyhelp (/u/Valley6660) --- README.md | 2 +- sol.c | 2 ++ sol.h | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index af223cf..801ce67 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,6 @@ licensing details, see `LICENSE`. ### P1 * none! \o/ ### P2 - * TODO: `:help` to show keyhelp (/u/Valley6660) * TODO: don't show cursor-highlight when inputting directly or with the mouse (/u/TooEarlyForMe) * TODO: suggest moves (`h` => hint) * TODO: cleanup: in `x2y()` functions there is a lot of replication and noise @@ -102,6 +101,7 @@ licensing details, see `LICENSE`. * DONE: inverted moves (if A->B doesn't work, try B->A) * DONE: - allow dragging the mouse * DONE: use `10` instead of `X` on card face (/u/Valley6660) + * DONE: `:help` to show keyhelp (/u/Valley6660) --> ## Notes diff --git a/sol.c b/sol.c index dca8b36..193319a 100644 --- a/sol.c +++ b/sol.c @@ -129,6 +129,7 @@ restart: case CMD_NEW: return GAME_NEW; case CMD_AGAIN: goto restart; case CMD_QUIT: return GAME_QUIT; + case CMD_HELP: printf (KEYHELP "\nPress any key to continue."); getch(NULL);break; } } } @@ -700,6 +701,7 @@ from_l: print_table(&active, &inactive); case 'q': return CMD_QUIT; case 'n': return CMD_NEW; case 'r': return CMD_AGAIN; + case 'h': return CMD_HELP; default: return CMD_INVAL; }} case 'J': diff --git a/sol.h b/sol.h index d3ce16a..87b7745 100644 --- a/sol.h +++ b/sol.h @@ -109,6 +109,7 @@ enum special_cmds { CMD_HINT, CMD_JOIN, CMD_UNDO, + CMD_HELP, }; enum event { @@ -204,6 +205,8 @@ struct undo undo_sentinel; " space : select at cursor (or left mouse click)\n" \ " return: draw from stock\n" \ " :n : new game\n" \ + " :r : restart game\n" \ + " :h : show keyboard help\n" \ " :q : quit\n" \ DIRECT_ADDR_KEYHELP //}}} -- 2.39.3