diff options
author | June McEnroe <june@causal.agency> | 2022-08-31 21:13:10 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2022-08-31 21:13:10 -0400 |
commit | ed0b67bfde7c4762d95c6132fad8d3fa66c6c76c (patch) | |
tree | 4643082f1a2a3fd989844b8b9904ee28ae4b15be | |
parent | Fill in some Info.plist fields (diff) | |
download | wep-ed0b67bfde7c4762d95c6132fad8d3fa66c6c76c.tar.gz wep-ed0b67bfde7c4762d95c6132fad8d3fa66c6c76c.zip |
Add F5 to restart game
-rw-r--r-- | freecell.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/freecell.c b/freecell.c index 28b277e..a346277 100644 --- a/freecell.c +++ b/freecell.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 C. McEnroe <june@causal.agency> +/* Copyright (C) 2019 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -340,12 +340,14 @@ static enum Choice chooseMove(void) { return choice; } +static uint currentGame; static void newGame(uint game) { if (!game) game = 1 + randUniform(32000); deal(game); char buf[sizeof("FreeCell Game #32000")]; snprintf(buf, sizeof(buf), "FreeCell Game #%u", game); SDL_SetWindowTitle(window, buf); + currentGame = game; } static Card hiliteRank; @@ -355,6 +357,7 @@ static uint fromStack = StacksLen; static bool keyDown(SDL_KeyboardEvent key) { switch (key.keysym.sym) { case SDLK_F2: newGame(0); return true; + case SDLK_F5: newGame(currentGame); return true; case SDLK_BACKSPACE: return undo(); } if (key.repeat) return false; |