From ed0b67bfde7c4762d95c6132fad8d3fa66c6c76c Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Wed, 31 Aug 2022 21:13:10 -0400 Subject: Add F5 to restart game --- freecell.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 +/* Copyright (C) 2019 June McEnroe * * 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; -- cgit 1.4.1